Want to work out what day of the week for any date? Just use the doomsday algorithm.

In the city where I grew up, there was a man who knew more about dates that anyone I’ve ever met. He was autistic, and if you gave him any date he would tell you (almost instantly) what day of the week it was. So you could tell him your birthday and he would tell you that you were born on a Thursday, or a Monday, or whatever.

As it turns out, there’s an algorithm for this impressive feat. It’s like solving a Rubik’s Cube: if you know the right moves, it’s not that complicated, but you do have to memorise the right moves.

This technique goes by the impressive name of the doomsday algorithm. It was invented by John Conway (the same guy who created the Game of Life). The system is surprisingly simple, and it hinges on one simple fact about the calendar.

In any given year, certain dates always fall on the same day of the week. “Pi” day (March 14th). 4/4 (April 4th), 6/6, 8/8, 10/10, and 12/12. Hallowe’en. Boxing Day. US Independence Day. These, in Conway’s system, are “doomsdays.” You can use these anchor days to calculate all the other days through simple addition and subtraction. If Hallowe’en is on a Monday, then November 1st is on a Tuesday, and so forth.

The tricky part of the algorithm is working out which day of the week all of a year’s doomsdays share. There’s a quick mathematical process you can follow (if you’re quick at math, that is):

- Begin with the “anchor day” for the first year to begin with those two numerals – 1800, 1900, 2000, etc. This part you have to memorize. The doomsdays for the year 2000 all fell on a Tuesday, so that’s our starting point.
- Take the last two digits of your target year and divide them by 12.
- Add the following three bits together: the bit before the decimal point (the “floor”) of the result, the remainder of the result, and the floor of the remainder divided by 4.
- Use that sum to count forwards from the century anchor day, and that gives you the anchor day for any particular year.

To demonstrate, let’s try this year. 22 (from 2022) divided by 12 is 1 with a remainder of 10. 10 divided by 4 is 2 (with a remainder that we’ll discard). 1+10+2=13. If we count 13 days forward from the century anchor day (Tuesday) we end on a Monday. So all of the doomsdays in 2022 fall on a Monday. Sure enough, Hallowe’en this year falls on a Monday. So does Boxing Day, April 4th, August 8th, etc.

Or let’s try 1862, the year that slavers kidnapped half the population of Rapa Nui. 62 divided by 12 is 5 with a remainder of 2. 2 divided by 4 is 0 when you discard the remainder. 5+2+0=7. The 19th century’s anchor day is Friday, and counting seven days ahead also gives you Friday. And what do you know? Hallowe’en 1862 was on a Friday, as are all the other doomsdays.

If that calculation is a bit too much for you, the link below has a list of doomsdays for all the years of the past century. It also goes into much more detail about how and why this algorithm works.

A student of Conway’s wrote him a tester computer program that would spring a date on him and have him calculate day of the week. He’d play it 20x each morning (I witnessed this firsthand several times, in ’92). On really good days he’d do the 20 of them in close to 20 seconds total. On his desk he had a triangularly-folded piece of paper, like a namecard at a symposium, with his personal best written out rather elaborately.