A method for finding the day of the week for any date -- in your head.

Thursday, January 27, 2011

Learn by Example

[Revised 7/29/2011]
This quick summary will show you, by example, how to determine the day of the week for any date -- in your head! (See the longer post for the full story.)

The given date is broken into four numbers, mm/dd/ccyy.  The four steps of the algorithm will each use one of these four numbers. The math is easy – we accumulate a running total we’ll call T. At the end, we’ll have a number in the range 0-6, representing the day of the week.

Summary of the First Sunday Doomsday Algorithm for the date mm/dd/ccyy

Step Description Description
for nerds
Conversion Tables and Memory Aids
1. Start with yy.
If odd, add 11.
Then cut in half.
If odd, add 11.
T = yy (if T is odd) T = T + 11
T = T / 2
(if T is odd) T = T + 11

Odd plus 11.”

Odd plus 11.” Again.
2. Add the century’s value. T = T + CFS[cc]
from table 

(Result is YFS)
1700s 1800s 1900s 2000s Covers American history
0 2 4 5 (Remember “No tuna for Friday.”)
(For years prior to the Gregorian correction, use CFS = cc.)
3. Add the month’s doomsday. T = T + MD[mm]
from table 





(Result is MFS)
Even month (except 2): Use the month number.
Odd month (except 1 or 3): Switch according to “Work 9 to 5 at 7-eleven.”
January: Use 3, three years out of four, but use 4 for leap years.
February: Use zero, but use 1 for leap years. It’s a binary switch.
March: Use zero. March is the easiest month.
4. Subtract total from dd. Day = dd – T
0=Sunday 1=Monday 2=Tuesday 3=Wed. 4=Thursday 5=Friday 6=Saturday
None-day One-day Twos-day 3 = “w” Fours-day Five-day Six-urday

Examples

What day was July 4, 1776 (U.S. independence day)?
1. 76 / 2 = 38
38; 3
yy is even, add nothing, just cut in half.
T is even, nothing to add. Then subtract sevens (38-35=3).
2. + 0 = 3 First entry in the century table (cc=17, first century in American history), so use the first word of “No tuna for Friday”. “No” stands for zero.
3. + 11 = 14; 0 The month (mm=7) gets switched to 11 according to the phrase “Work ... at 7-eleven”. Then remove a pair of sevens.
4. 4 - 0 = 4. Thursday dd=4. Result 4 = “Fours-day”.
OK, that example was presented very concisely, and you’ll need some explanation. In step 1, we started with the two-digit year, 76. Because it’s even, we skipped the “add 11” instruction. After dividing by 2, we checked the result for oddness, and we skipped the second “add 11” instruction. That’s it for step 1, but there’s some simplification to do.

As you know, adding (or subtracting) 7 to a date leaves the day of the week unchanged. At the end of each of our four steps, you can (optionally) subtract 7 (or 14, etc.) from the running total T. In the example, the notation “38; 3” means that we removed excess sevens from the total of 38, leaving a simplified total of 3.
In step 2, we add a value based on the centurial number. For each century, there is a value you need to remember, as shown in the summary chart. This little table is very easy to recall if you remember the nonsense phrase “No tuna for Friday”. The phrase gives you the four values (0, 2, 4, 5), corresponding to the four centuries in American history. In the example just shown, you only needed to recite the first word of the phrase, “No…”, to realize we need to add nothing to our running total for our year in the 1700s.

In step 3, we add a value based on the month number. Once again, there’s a table shown in the summary chart, and another nonsense phrase to remember. In this example, the 7 (July’s month number) gets swapped with the value 11, which we add to our running total: 3+11=14. Removing excess sevens at the end of the step, we can call our total zero. (Month 11 would get the value 7. Months 9 and 5 get swapped the same way.)

In step 4, following the instructions in the chart, we subtract our total T from the date, resulting in 4. This value corresponds to Thursday, using the table in the chart. You’ll memorize this table quickly, thanks to the “nonsense words” combining day names with the numbers 0-6.

The first example had lots of zeros or “do nothing” steps. The next example won’t have all those lucky breaks. It will also address the problem that occurs when the subtraction in step 4 gives a negative result

What day was May 1, 1895?
1. 95 + 11 = 106
/ 2 = 53
+ 11 = 64; 1
yy is odd, so add 11.
Cut in half.
T is odd, so add 11. Remove excess sevens (64-63=1).
2. + 2 = 3 Recall the century table, “1700s, 1800s”. For cc=18, use the second word of “No tuna for Friday”. “Tuna” stands for 2.
3. + 9 = 12; 5 The month (mm=5) gets switched to 9 according to “Work 9 to 5...” . Then remove an excess seven.
4. 1 – 5 =  -4??
7 – (5-1) = 3. Wednesday
Darn, that’s going to be negative, so…
Go ahead and find the negative value, then take the sevens complement. Result is 3, “Wednesday”.
The “sevens complement” is a fancy name for the way we “negate” a negative number: just subtract the value from seven.

August 4, 1962
1. 62 / 2 = 31
+ 11 = 42; 0
yy is even, just cut in half.
T is odd, so add 11. Remove excess sevens.
2. + 4 = 4 Add 4 for the 1900s. (“No tuna for Friday”.
3. + 8 = 12; 5 Even month; use the month number. Remove a seven.
4. 4  – 5 = –1??
7-1 = 6.  Saturday
Figure the negative result,
then complement to get 6, “Six-urday”.

December 7, 1941 (Pearl Harbor day)
1. 41 + 11 = 52
/ 2 = 26
26
yy is odd, so add 11.
Cut in half.
T is even, nothing to add.
2. + 4 = 30; 2 Add 4 for the 1900s. Remove sevens.
3. + 12 = 14; 0 Even month; use the month number. Remove sevens.
4. 7 – 0 = 7; 0. Sunday None-day.

December 31, 1899
1. 99 + 11 = 110
/ 2 = 55
+ 11 = 66; 3
yy is odd, so add 11.
Cut in half.
T is odd, so add 11. Remove excess sevens.
2. + 2 = 5 Add 2 for the 1800s.
3. + 12 = 17; 3 Even month; use the month number. Remove sevens.
4. 31 – 3 = 28; 0. Sunday None-day.

January 1, 1900 (The next day, to test the previous example’s answer)
1. 0 / 2 = 0
0
Even, so just divide by 2.
T is even, nothing to add.
2. + 4 = 4 Add 4 for the 1900s.
3. + 3 = 7; 0 1900 was not a leap year, so this January's doomsday is 3, not 4!
4. 1 – 0 = 1. Monday One-day.


Here’s the best part of the First Sunday Doomsday Algorithm: If you remember the result of step 2 (called the year’s first Sunday), you can use it throughout the current year, starting the algorithm with step 3. If you remember the result of step 3 (called the month’s first Sunday), you can use it throughout the current month, performing only step 4. To remind yourself of this month’s first Sunday, whenever you look at a calendar, repeat to yourself the date at the top of the Sunday column.
The older post below gives a longer explanation of the algorithm.