Written by Colin+ in ninja maths.

Today's the day you should be outside looking for the man with as many noses are there are days left in the year!

However, if you've spotted him, you could turn your attention to something all mathematicians have trouble with: knowing what day of the week it is.

This is something Lewis Carroll came up with an amazingly convoluted method for working out -- it involved thinking about whether your month started or ended in a vowel, among other things. This method -- the Doomsday Method -- is better, and not just because it has a better name.

So, pick a date -- preferably one you know the day of the week for. Alternatively, you can check with a calendar at the end to make sure it works. What we're going to do is this: generate a number that corresponds to the day of the week. I'm going to work with today (31st December, 2012) because I know it's a Monday and 1st May, 1997, because I remember it being a general election and these things happen on Thursdays.

There are three steps to the Doomsday Method: the first is to think about the century. If your year starts with 18, you need to start from 5; if it starts with 19, you start from 3; and if it starts with 20, you start from 2. The reason is, most centuries have 36524 days (which is 2 less than a multiple of seven), so each century moves you back two days in the week. Except, of course, if the last year of the century is a leap year -- like 2000 -- in which case, you move back only one day. Between the 19th and 20th century, you moved back two days; between the 20th and 21st you moved back one. So, for today, my total so far is 2; for May Day, it's 3.

The second step is to find a number for the year. This is the tricky bit for me. The easiest way I know is to count how many 12s there are in the year bit, add 1 for each year after that, and an extra 1 for each leap year after that. For instance, 1969 would be 5 (because $5 \times 12 = 60$) + 9 (because there are 9 more years) + 2 (because '64 and '68 were leap years), a total of 16. But we're not doing 1969. We're doing 2012 (which adds 1) and 1997 (which adds $8+1=9$). So, our totals so far are 3 (for today) and 12 (for May Day).

Clever bit here: there are only seven days in the week, so if we hit a number above 7, we can just take seven away. That's modulo arithmetic, something you'll grow to hate if you ever take first year university maths. However, here it's our friend: 12 is the same as 5, so far as we care. So, we have 3 for today, and 5 for May Day.

Lastly, we want to find a number for the day of the year. This is also a bit tricky, but there are short cuts. Did you know, for example, that 4/4, 6/6, 8/8, 10/10 and 12/12 all fall on the same day of the week in any given year? Check it, if you like. It's also the same day as 9/5 and 5/9, as well as 7/11 and 11/7. (Plus, in case you needed more, the last day of February, the 4th of July, Hallowe'en and Boxing Day). That day is Doomsday. For 2012, Doomsday is Wednesday (3). For 1997, it was Friday (5). For 1969, it would also have been 5, if you cared to work it out.

So, to find the date for December 31st, you'd say "December 12th was the same day as the 19th and the 26th and the 33rd1, so the 31st is two days before Doomsday. That makes it 3 - 2 = 1, which means Monday.

For May 1st, you'd say "I know May 9th is the same day as May 2nd, so it's one day before that, and 5 - 1 = 4, which is Thursday."

Wait, wait, wait. Where am I getting these number-day links from? Well, it's just the number of the day in the week. One-day is Monday, Twos-day is Tuesday, Wednesday starts with a 3 that's fallen over, then Fours-day is Thursday, Five-day is Friday, Sixer-day is Saturday and None-day is Sunday.

Armed with all of that, you can find the day of the week for any date you like!

- Yes, yes, I know. [↩]