The Doomsday Algorithm
The only trick that impresses people in parties. Give me a date and I'll give you the day.
This method was devised by John Conway in 1973 (his paper starts on page 28), and it’s a pretty handy little trick once you get the hang of it. I’ll first cover the various methods and then how it works.1
I’ll be using DD/MM/YYYY.
2/2, 4/4, 6/6, 8/8, 10/10, 12/12 all fall on the same day. (Pretty nifty already! )
So does 5/9, 7/11, 9/5, 11/7 , 3/1 (4/1 for a leap lear) and the last day of February. An easy way to remember this is the mnemonic- ‘‘I work 9 to 5 in a 7-11.’’ The only month left out is March, for whom the matching date happens to be pi-day (14/3).
We can call this shared day to be the doomsday. So to determine the day of a date, all we need to do is determine the doomsday of that year, then choose the closest date that matches up to it and count up or down to the desired date.2
The only doomsdays you’ll have to cast to memory are:
1700 - Sunday
1800 - Friday
1900 - Wednesday
2000 - Tuesday
The doomsdays cycle back after this, so the doomsday of 2100 is the same as that of 1700.
Now, to determine the doomsday of the desired year we need to subtract the year with the chosen century, add the number of leap years between them (including the chosen year), then take the remainder of this sum when divided by 7 and add it to the century’s doomsday.
This may seem a bit complicated, so let me show you in the following manner.
doomsday(ABCD)=doomsday(AB00) + (CD + number of leap years b/w) mod 7
So let us say you need to find out the doomsday of 2096. This would be equal to Tuesday+ (96 + (96/4) ) mod 7 =Tuesday + (96 +24) mod 7 = Tuesday +1 = Wednesday.
Turns out that 4th January, 2096 is indeed Wednesday!
We can make our calculations faster by attributing numbers to days and by noticing that years that are 28 years apart share the same doomsday.3
0 - Sunday
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 -Saturday
So now for our calculation for 2096, we see that 2084 is the closest matching year.
doomsday(2096) = (2 + 12 + 3) mod 7 = Wednesday !
Next, to find the day of the desired date, just count up/down to it.
For example, for 28th December, 2096 we know that 12/12/2096 is Wednesday (3).
Now, you can either calculate directly [ (3 + (28-12) ) mod 7 = 5 = Friday ], or you can jump to the closest matching date by jumping in 7s (in this case, 26th) and count up/down from there.
I find this method to be a nice mental exercise as well, but if you’re looking to skip a bit of calculation you can use the ‘‘odd + 11’’ rule published by Chamberlain Fong and Michael K. Walters in 2011.
This is how it follows:
Let X be last two digits of that year.
If X is odd, add 11.
Now divide X by 2.
If X is odd, add 11.
Now let Y= 7 − (X mod 7).
Count forward Y days from that century's doomsday to get the year's doomsday.
For 2096, 96/2 = 48, Y = 7 - (48 mod 7) = 1 , Tuesday + 1 = Wednesday !
So now you know. Go ahead and be a wizard.
For lack of time, I’ll add this in at a later date.
When tracing backwards, it only works up till the point that the country started utilising the Georgian calendar. For example, for England it doesn’t work before 1753.
I’ll add in the reason in the near future.