# Magic or maths? Find the day of the week for any date

## Devised in the early 1970s, the Doomsday Algorithm involves memorising codes, century-specific days, and dividing numbers by 12 or four, writes Jason England.

Martin Gardner is the inspiration behind this column. As many readers know, Gardner wrote his own column, called “Mathematical Games”, in *Scientific American* from 1956 to 1985.

It sat squarely within the nexus where recreational mathematics, puzzles, games, magic, art and science intersect. His compiled articles required 14 large volumes to contain them all.

Those, and the several dozen other books he wrote in his 95 years, comprise an incredible body of work. Every time I sit down to write, I ask myself if Martin would have been interested in the subject matter.

Recently I attended the *Gathering 4 Gardner* in Atlanta, Georgia. The G4G, as it’s called by attendees, is a biennial conference of 300 mathematicians, puzzle makers, magicians and artists who consider themselves ardent Martin Gardner fans. They gather in even-numbered years to celebrate and share the latest and greatest discoveries in recreational mathematics. Gardner himself was present at the first two conferences in the early 1990s, but was uncomfortable with the celebrity attention he received. He gave his blessing for future events but never attended again.

This year’s final dinner show closed with a demonstration by mathematician and acknowledged genius John Horton Conway. Conway is Professor Emeritus of Mathematics at Princeton University, with expertise in knot theory, number theory and combinatorial game theory. He is perhaps most famous for creating the computer simulation called *Game of Life*, in 1970.

Conway asked three audience members to stand. Each was asked to name their birthdate. In turn, Conway, who is nearly 80, almost instantly announced the day of the week on which they were born. The room erupted in applause.

What he did is commonly referred to among magicians and recreational mathematicians as “calendar calculation”. Conway uses a system he devised in the early 1970s (curiously, after a conversation with Martin Gardner) called the Doomsday Algorithm. The process involves memorising codes, century-specific days, and dividing certain numbers by 12 or four.

There is a similar but simpler method to determine the day of the week for any date. If you can do some basic division and addition in your head, you should, with practice, be able to perform the calculation in a matter of seconds.

First, you need to memorise the following “month codes”:

In leap years, subtract one from the month code for January and February only! Leap years are any years where the last two digits of the year are a multiple of four. The exception to this rule are century years (those ending with 00) where the whole number must divisible by 400. Thus 1800 and 1900 were not leap years, while 1600 and 2000 were.

To begin, you take the last two digits of the year and divide the number by four.

Disregarding any remainder, add the result to the number you began with.

Add the month code number.

Add the day of the month.

Divide this total by seven.

Now disregard the whole number and focus on the remainder. It is the remainder that will tell you the day of the week, according to the following day codes.

They are relatively easy to remember since they begin with Sunday as the first day of the week. The only quirk is that a remainder of zero equates to Saturday.

For dates in the 1800s, add two to your total. For dates in the 2000s, subtract one. You can do this any time *before* the final step of dividing by seven.

Let’s look at an example: 17 January 1953. The first step is to divide 53 by four, ignoring any remainders. Answer: 13.

Add 13 to 53, to get 66. Add the “month code” (which for January is one) to get 67. Add the day of the month (17) to 67, making the result 84.

Finally the last step; divide 84 by seven. The answer is 12 with a remainder of zero. All we care about now is the remainder. Zero tells us that 17 January 1953 was a Saturday.

The mental division steps are the most difficult part of this method so here’s a tip: you can “cast out sevens” as you go!

For example, take the date 6 December 1920. 20 divided by four is five. Adding five back to 20 gives us 25. If you want, you can divide 25 by seven right now and remember only the remainder (which is four). Add this remainder to the month code for December (six) to get 10. Divide by seven again and keep the remainder (which is now three). Add this new remainder to the day you want (the sixth) to get nine. Divide by seven one final time to get a remainder of two. This tells us that 6 December 1920 was a Monday.

Casting out or dividing by seven as you go at each step is usually much easier than initially doing all of the addition and then dividing the large total by seven at the very end. The result is the same either way.

With practice just about anyone can get this method down to under 15 seconds. With a *lot* of practice, you might just become the next John Conway!

This article appeared in Cosmos 74 - Autumn 2017 under the headline "Divide and conquer for your day in the Sun"

*Jason England is a magician based in Las Vegas and a renowned authority on casino gambling and card handling.*