# Day of the week from the date.

I still remember when I was a kid some senior student used to ask us a date from history and then tell us what day was then within 20 seconds. I read montgomery's Number theory and when found the algorithm which says that Let $N$ denote the date, $M$ denote the month (counting from March), $C$ denote the number of hundreds in the year and $Y$ denote the rest and $D$ denote the days (counting from monday) then the formula says-

$D= N+[2.6M-0.2]+Y+[Y/4]+[C/4]-2C-(1+L)[M/11] (mod7)$, where [] denotes the greatest integer function and $L=1$ for a leap year and $L=0$ otherwise.

Using it if we look up $1$ january, $2001$, $N=1, M=11, C=20, Y=1$ it comes out Monday i.e. congruent to $1$ (mod$7)$.

Now I wonder, no one except some prodigies can answer this quick using this. Is there any other way of finding it without paper and pen within a minute at maximum.( any shortcut)

The method I use is a mix of Robert Goddard's First Sunday Doomsday method and a method published by W.W. Durbin and E. Rogent back in 1927. It involves a quick calculation for the year, and memorization for the month.

YEAR - Last 2 digits: There are 3 quick steps to deal with the last two digits of the year - Partition, Convert & Solve, and Cast Out Sevens.

Partition - Partition the number into a sum of the largest multiple of 4 equal to or less than the last 2 digits of the year, and 1, 2, and 3 (if needed). For example, for a year ending in 55, you'd partition 55 into the sum 52 + 3. A multiple of 4, of course, would just remain as itself (64 would remain as 64 for this step).

Convert & Solve - Starting from the sum in the previous step, divide the multiple of 4 by 2, change the plus sign to a minus sign, and solve this new problem. In our 55 example, we partitioned that into 52 + 3. For this step, we divide the 52 by 2 to get 26, and change the plus sign to a minus sign, giving us the new problem of 26 - 3, which equals 23.

Cast Out Sevens - This step means just what it says. If you're not familiar with casting out sevens, it simply refers to subtracting the largest multiple of 7 equal to or less than your current total from that total. Our current example total is 23, and the largest multiple of 7 equal to or less than this number is 21, so we subtract 23 - 21, which equals 2.

Note - This process does result in negative numbers for 4 particular years: 01, 02, 03, and 07. When you get a negative result, simply add 7.

01 = 0 + 1, which becomes 0 - 1 = -1. -1 + 7 = 6.
02 = 0 + 2, which becomes 0 - 2 = -2. -2 + 7 = 5.
03 = 0 + 3, which becomes 0 - 3 = -3. -3 + 7 = 4.
07 = 4 + 3, which becomes 2 - 3 = -1. -1 + 7 = 6.

YEAR - Century: In this step, you'll use your year total from the previous steps, add 1 of only 4 different numbers, and then cast out 7s again, if needed.

Here is what to add, depending on the first two digits of the year:

1700s: 0
1800s: 2
1900s: 4
2000s: 5

After this, the numbers repeat in the same pattern. For the 2100s, you'd add 0. For the 2200s, you'd add 2. For the 2300s, you'd add 4. For the 2400s, you'd add 5, and so on.

This part works for the Gregorian calendar only. If you need Gregorian dates in the 1600s, add 5 (just like the 2000s), and for Gregorian dates in the 1500s, add 4 (just like the 1900s).

In the year calculation above, we started with a year ending in 55, and wound up with a year total of 2. If the given year was in the 1900s, we'd add 4 in this step. 2 + 4 = 6. This total is less than 7, but if the number were 7 or more, you'd cast out 7s, just like above.

So, we've taken 1955 as an example, and reduced it to the number 6. What about months?

MONTHS: For this step, you simply need to be able to memorize and recall 7 different poems that associate 1 or more months with a day of the week:

February, March, and November,
Three for Sunday to remember.

June-day?
Moon-day!

Skeptics need clues,
But Sept./Dec. needs Tues.!

Winds in April, Winds in July,
Winds-day's the day, wet or dry.

Jan.'s and October's 31s,
Remind us that Thursday won.

Month 5 is May,
Day 5 is Friday.

August's few holidays make us yearn,
For the day off named after Saturn. ("Saturn"-day, or Saturday)

Leap Year Note - In leap years, January and February change their day association by moving back 1 day. A leap-year January is associated with Wednesday, and a leap-year February is associated with Saturday.

So, if someone asks about October 1955, you know from your year calculations that 1955 reduces to 6, and from the poems above, you should be able to recall that October is associate with Thursday. This tells you that October 1955 must have had a Thursday the 6th. Knowing that, you should be able to workwont the day for any other date that month.

You can verify all my date claims here: http://www.timeanddate.com/calendar/monthly.html

This may sound long and drawn out, but it really is simple once you get used to it. Let's try another example. This time, we'll work out May 2037.

LAST TWO DIGITS OF YEAR:
Partition: 37 becomes 36 + 1
Convert & Solve: 36 + 1 becomes 18 - 1, which equals 17.
Cast Out Sevens: 17 - 14 = 3.

FIRST TWO DIGITS OF YEAR:
2000s mean add 5, so 3 + 5 = 8.
Cast Out Sevens: 8 - 7 = 1.

2037 is associated with 1, and May is associated with Friday, so May 2037 must have a Friday the 1st!

LAST TWO DIGITS OF YEAR:
Partition: 68 remains 68
Convert & Solve: 68 becomes 34.
Cast Out Sevens: 34 - 28 = 6.

FIRST TWO DIGITS OF YEAR:
1800s mean add 2, so 6 + 2 = 8.
Cast Out Sevens: 8 - 7 = 1.

Februarys are normally associated with Sunday, but in leap years, they're associated with Saturday, Since our total from 1868 was 1, February 1868 must've had a Saturday the 1st.

BONUS - JULIAN YEARS: To work out a year under the Julian calendar, the steps are all the same, except for the step involving the century. Instead of adding 0 for the 1700s, 2 for the 1800s, and so on, this step becomes even easier!

When dealing with the century, just add the century digits! Need to adjust for a year in the 1200s? Add 12! Need to adjust for a year in the 500s? Add 5!

This ingenious alteration is due largely to Robert Goddard's work on his First Sunday Doomsday Algorithm.

Let's work out December 814 as an example:

LAST TWO DIGITS OF YEAR:
Partition: 14 becomes 12 + 2
Convert & Solve: 12 + 2 becomes 6 - 2, which equals 4.
Cast Out Sevens: No need, as 4 is less than 7.

FIRST TWO DIGITS OF YEAR:
800s? Add 8! 4 + 8 = 12
Cast Out Sevens: 12 - 7 = 5.

814 gives us 5, and December is associated with Tuesday, so December 814 must've had a Tuesday the 5th!