John Conway’s “Doomsday Calendar”

[This wound up being Part 1 of 3. You can find Part 2 here, and Part 3 here. You don’t need to read all three parts, but Part 3 does actually describe a significantly simpler algorithm than the one Conway used.]

John Horton Conway, a great mathematician of unmatched playfulness, died recently at age 82 of Covid-19. His biographer, Siobhan Roberts, wrote an excellent New York Times obituary. Conway was something of a showman, in a good way, so I should give a spoiler alert up front, especially these days, that this has nothing to do with Doomsday as in the end of the world.

Photo by Denise Applewhite, Princeton University Office of Communications

I never met Conway, but in the mid-70s my math camp buddy Rob Indik had a summer in which he commuted to the UI Chicago campus “with Vera [Pless] driving, Conway in front, and me riding in the back and trying to ride along with Conway’s free flow of ideas.” I remember Rob regretting that he couldn’t remember a mental “perpetual calendar” that Conway had taught him. In the computer age we have no call for perpetual calendars, but back when dinosaurs roamed the earth they were novelty items: a small object with a few dials, which would let you figure out what day of the week any date falls on. A mental one sounded like fun, and I occasionally thought—not very hard—about how you might go about it. I never got very far. [I see that this is not the definition of “perpetual calendar” favored by Wikipedia, but that the American Heritage Dictionary has me covered.]

With Conway’s death, I decided to look it up, and found that it’s around the web in several places, but without a very clear explanation of why it works. So I thought I would explain both how it works and why it works.

The basis for any shortcut involving days of the week is to work “modulo 7.” If you move ahead (or back) by 7 days, any number of times, the day of the week will always be the same. Seven days from now (+7), seven days ago (-7), 14 days from now (+14) … they all fall on the same day of the week as today (which you can think of as “moving 0 days”). And all those numbers (7, -7, 14, and 0) are equal modulo 7. Similarly, tomorrow (+1) will fall on the same day as 8 days from now (+8), or 6 days ago (-6). You probably understand this intuitively: if I ask you, “What day of the week is 6 days from now,” chances are you won’t count up, you will realize that it is the same day as yesterday. That is, 6 is equal to -1 modulo 7.

As a first step, let’s notice that the perpetual calendar problem would not be very difficult if there were no leap years. There are 52 weeks in a year, and 52 x 7 is conveniently 364. So 365 is just 52 weeks plus one day. If today is Friday, 365 days from now will be Saturday. In terms of arithmetic modulo 7, 365 = 52×7 + 1, and because 7 is equal to 0 modulo 7, this is equal to 1 modulo 7. If every year has 365 days, then if January 1st is a Monday this year, it will be a Tuesday next year, Wednesday the year after that, and so on, until 7 years from now it is back to Monday. But leap years exist, and they make two problems: the 366-day year advances the next year by two days, and it advances everything after Feb 29 by one day.

There are two parts to Conway’s solution: the first part is to “anchor” a year to a particular day, and then figure out what day of the week some given date during that year falls on. The second part is to figure out what day any particular year is anchored to.

I will also mention that all the writeups I’ve seen of Conway’s method involve numbering the days modulo 7, and memorizing: 0 for Sunday, 1 for Monday, and so on until 6 for Saturday. You can do that, and it will probably help you do the calculations faster, but as you’ll see below, it isn’t necessary. We will come up with numbers that are “offsets” (like +4 or -1), and you will need to count 4 days forward from Tuesday, or one day back from Friday. If you have memorized that Tuesday is 2 and Saturday is 6, then you can tell me that Saturday is 4 days forward from Tuesday more quickly than someone who hasn’t, but you’ll both be able to tell me.

What are Doomsdays, and how do you use them?

Conway anchors his year to what he calls “Doomsdays”: days on the calendar that always fall on the same day of the week. If you don’t like calling them Doomsdays, you could call them “anchor days.” Most people would probably anchor the year to January 1st, resulting in leap-year headaches for the 10 months starting in March, but Conway brilliantly chose to anchor it on the last day of February, confining headaches to the first two months. If the last day of February is the first “Doomsday,” then March 7, 14, 21, and 28th are all Doomsdays. The next one is… well you can either work it out by counting laboriously out loud, or you can say it’s March 35th. Subtract the actual 31 days of March and you will find that 4/4 is the next one. Proceeding in this way, you will find that the following are all Doomsdays:

  • 4/4
  • 5/9
  • 6/6
  • 7/11
  • 8/8
  • 9/5
  • 10/10
  • 11/7
  • 12/12

Why did Conway list 10/10 rather than, say 10/3? This is another combination of brilliance and luck: for the even months, the Doomsdays 4/4, 6/6, 8/8, 10/10, and 12/12 are all super easy to remember. The odd months on the list are covered by the mnemonic “Working 9-5 at the 7-11”: 5/9, 9/5, 7/11, and 11/7.

So let’s try something out. This year, 2020, is a leap year. I’m writing this on Friday, April 17. April 18 is a Doomsday, so all the Doomsdays this year are Saturdays. What day will Christmas be? 12/12 is a Doomsday, and then so are 12/19 and 12/26. So 12/26 is a Saturday, and 12/25 is, like today, a Friday. Let me check that… Yes, it’s true.

What about January and February? What day was Valentine’s day this year? Well, February is also pretty easy, because the last day of February is a Doomsday. This year is a leap year, so 2/29, 2/22, and 2/15 are Doomsdays, so, gee, 2/14 was also a Friday.

How about January 1? Well, in a leap year, 2/1 is a Doomsday, so 1/25 is, and 1/18, 1/11, and 1/4 are too. So the next mnemonic: “Every 4th year 1/4 is a Doomsday.” In non-leap years, the Doomsday is pushed one day back, to 1/3. So this year, January 4, being a Doomsday in this leap year, was a Saturday. Counting backwards, 1/3 was Friday, 1/2 was Thursday, and 1/1 was a Wednesday. (Checks again.) Yes! It works.

So if you have a date that you want to figure out, once you know what day of the week the Doomsday is for that year, you can find a Doomsday near to it and count up or down. That is how Conway solves that half of the problem. But how do you figure out the day of the week that a Doomsday falls on, given a particular year? Back to leap years.

Which years are leap years, again?

As I said, it would be really easy if there were no leap years at all. Having leap years every fourth year makes it more complicated. And the fact that leap years don’t happen every fourth year, just most fourth years, makes it even more complicated! What is the actual rule? If a year is divisible by 4, it’s a leap year. Except… if it’s divisible by 100, it’s not. Unless… it is also divisible by 400, in which case it is. This is actually a fairly simple rule, when you consider that you are trying to match up two things that have essentially nothing to do with each other: the length of a year and the length of a day (more on that in Part 2).

What day of the week is Doomsday, for years ending in 00?

Doomsday for 1700 was Sunday. Let’s take that as a given for now, but we’ll show below that it is correct. How can we figure out Doomsday for 1800? Each year will advance the Doomsday by one day, and each leap year will advance it by one additional day. And because Doomsday is the last day of February, moving from this year to next year we advance by 2 if next year is the leap year. So in a century, Doomsday will advance by 100 days, plus the number of leap years. 49 is a multiple of 7, so—working modulo 7—each 50 years advances by 1 day; 100 years advances by 2 days. In a century there would be 25 leap years (100 divided by 4), except that ’00 may or may not be a leap year, so there will either be 24 or 25. To go from one century to the next, the relevant question is whether the following ’00 is a leap year. 1800 is not, so there are 24 leap years to go from 1700 to 1800. Take away 7×3, and we advance 3 days due to leap years. That, plus the two days we advanced for the 100 years says we should advance by 5 days. Modulo 7, +5 equals -2, so it’s the same as going by 2 days.

Doomsday 1700 was Sunday, so Doomsday 1800 is Friday. 1900 is not divisible by 4, so again we go back 2, to Wednesday. 2000, being divisible by 400, is a leap year, so we advance by one additional day; instead of moving back by 2 days, we only move back 1 day. So Doomsday 2000 is Tuesday. Doomsday 2100: move back 2, and we have another piece of good luck. We are back to Sunday! Every four centuries, we have 3 centuries where we advance by 2, and one where we advance by 1, for a total of 7, so the pattern repeats.

You can work this out in your head, or you can memorize the repeat, and work either forward or backward, from this list of anchor days:

  • 1700: Sunday
  • 1800: Friday
  • 1900: Wednesday
  • 2000: Tuesday

OK, but most years don’t end in 00, right?

Right. But the intervening years should be easy! Take the last two digits, figure out how many times 4 goes into it, and add those two numbers together modulo 7, because each year advances it by 1, and each leap year advances by an additional 1. Let’s look at October 28, 1929. We advance one for each of the 29 years. 29 is equal to 1 modulo 7, since 28 is a multiple of 7. So for the years, we advance by 1. For the leap years, 4 goes into 29 7 times, so we advance by 7, which is 0 modulo 7, in other words, no change. So Doomsday 1929 is advanced by 1 from 1900’s Wednesday: it is Thursday. 10/10 is Doomsday, so are 10/17 and 10/24 are, too. So to get to October 28, advance 4 from Thursday, and you get to Monday. Which checks out, because October 28, 1929 is known as “Black Monday,” due to the stock market crash.

That is actually pretty laborious, and not suitable for lightning-fast mental calculations for most of us, Conway included. So for the next part, Conway used a trick originated by Lewis Carroll (as described in Part 2.) Each 4 years will advance by 5 days (one for each year, and one for the leap year), so after 12 years, we will advance by 15 days, which is the same as advancing by 1.

So here’s what you do. Take the last two digits of the year. Let’s say 12 goes in q times, with a remainder of r (which will be between 0 and 11, inclusive); this is relatively easy to do in your head. For example, 29 = 12×2 + 5. For each 12 year block, we advance by 1, so we need to advance by q.

Then we can deal with r just as we did above: advance by r days, and one additional for each time 4 goes into r.

So for 1929: we advance 2 for q; another 5 for r; and another 1 because 4 goes into 5 once. Modulo 7 this is just 2+5+1, which is 1. So we get the same answer as the long way: advance 1900’s Wednesday by 1, to Thursday.

So let’s check 2020. 12 goes into 20 once (q=1) with a remainder of r=8. 4 goes into 8 twice. So for 2020, we need to advance from 2000 by 1+8+2 modulo 7, which is 4. We said above that Doomsday 2000 was Tuesday, so Doomsday 2020 is Saturday. Which is exactly what we said above, based on the actual calendar for 2020. Working backwards, that means that we were correct that Doomsday 1700 was Sunday!

And that’s all there is to it. Except that it doesn’t work for any year before 1582, and for any year in the Anglo-American world before 1752, as explained in Part 2. And as clever as Lewis Carroll was, there is actually a significantly simpler way to do this second part, as explained in Part 3.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.