Mathematical poem to calculate the "day of the week" for any day of any year.

 
The last of Feb., or of Jan. will do
(Except that in Leap Years it's Jan. 32)
Then for even months use the month's own day,
And for odd ones add 4, or take it away*

Now to work out your doomsday the orthodox way
Three things you should add to the century day
Dozens, remainder, and fours in the latter,
(If you alter by sevens of course it won't matter)

In Julian times, lackaday, lackaday
Zero was Sunday, centuries fell back a day
But Gregorian 4 hundreds are always Tues.
And now centuries extra take us back twos.

*According to length or simply remember,
you only subtract for September, or November.


*************************
J. H. Conway, Jan., 1976
*************************

An Example of How to do the calculation The best way to go about using this poem to calculate the day of the week is to work backward in the poem. That is, start with the third part and figure out the century day first. For 1997, we would use the Gregorian calander, so we start by looking at the century day for the year 400 (or 800 or ... or 1600 or 2000) which always gives Tuesday as the century day. Hence, taking the 16th century (1600) and adding a century ("centuries extra") gives us Sunday ("Tuesday back two") as the century day for 1700. Similarly, we will get Friday for 1800 and Wednesday for 1900 as the century day.

Now working with Wednesday as the century day for our 1997 year, we take "Dozens, remainder and fours in the latter" from 97.
  • Dozens gives us (97 DIV 12 = 8) eight twelves,
  • Remainder gives us (97 MOD 12 = 1) one remainder, and
  • Fours in the latter gives us (1 DIV 4 = 0) zero fours in the latter.
Now adding these ( modulas 7; "If you alter by sevens of course it won't matter") to the century day (Wednesday) we get:
  • Wednesday + 8 + 1 + 0 = Wednesday + 9 = Wednesday + 2 = Friday
Therefore, Friday is the doomsday for 1997.

Finally, the first part will complete the calculation in the following way:
  • "The last of Feb., or of Jan. will do (Except that in Leap Years it's Jan. 32)" [Note it's not a leap year]:
    • January(01) 31th is a Friday.
    • February(02) 28th is a Friday.
  • "Then for even months use the month's own day:
    • April(04) 4th is a Friday.
    • June(06) 6th is a Friday.
    • August(08) 8th is a Friday.
    • October(10) 10th is a Friday.
    • December(12) 12th is a Friday.
  • "And for odd ones add 4, or take it away* (*According to length or simply remember, you only subtract for September, or November.)":
    • March(03) 7th is a Friday.
    • May(05) 9th is a Friday.
    • July(07) 11th is a Friday.
    • September(09) 5th is a Friday.
    • November(11) 7th is a Friday.


Source:
http://www.cs.wustl.edu/~ksl2/mathpoem.html
Connect with Facebook
Loading