Saturday, 20 August 2016

Modulo Arithmetic and Days of the Week

Yesterday, I noticed something curious about the Wikipedia entries for days of the year. Here's an example from January 1:


The text that caught my eye is:
This date is slightly more likely to fall on a Tuesday, Friday or Sunday (58 in 400 years each) than on Wednesday or Thursday (57), and slightly less likely to occur on a Monday or Saturday (56).
Huh? At first I thought this was an obvious mistake; surely the days of the week are evenly distributed. After all, there are 365 or 366 days in a year and 7 days in a week, and these numbers are relatively prime.

Here's my (erroneous) line of reasoning:

  1. Neither 365 nor 366 are divisible by 7. [True]
  2. Therefore, January 1 can be any day of the week. [True]
  3. The "leap year" cycle repeats after 400 years. [True]
  4. But 400 is not divisible by 7. [True]
  5. Therefore, the "leap year and January 1 weekday" cycle repeats every 2800 years. [False]
My mistake was trying to divide 7 (the number of weekdays) into 400 (the number of years in a "leap year" cycle). What I should have done is try to divide 7 into the number of days in a "leap year" cycle.

So, how many days are there in 400 full years? Well, there are (100 - 4 + 1) = 97 leap days, so there are (365 * 400 + 97) = 146097 days.

Amazingly, 146097 is divisible by 7, so the "leap year and January 1 weekday" cycle repeats every 400 years, not every 2800 years. As we know, 400 is not divisible by 7, so this cycle cannot possibly have a uniform distribution of weekdays for January 1.

Indeed, even leap days (February 29) are not immune from this lack of uniformity because 97 is not divisible by 7. In any 400 year period, there are:
  • Thirteen each of Mondays, Wednesdays and Fridays,
  • Fourteen each of Saturdays and Sundays, and
  • Fifteen each of Tuesdays and Thursdays.

At this point in the discussion, someone usually witters on about calendar reform.

So why not...

Imagine reforming the calendar such that January 1 is always a Saturday but without forsaking the 7-day weekly cycle. One scheme would be to have a 52-week standard year (364 days) with periodic "leap weeks" (371 days). If we define a leap year to be any year that is divisible by 6 or 62 we end up with a 186-year leap cycle with 153 standard years and 33 leap years, making a total of (153 * 364 + 33 * 371) = 67935 days. That implies that the mean year length is (67935 / 186) = 365.2419355 which is closer to the solar year of roughly 365.242181 days than the current Gregorian calendar (365.2425).

So here's the new scheme:

  • A standard year is 364 days, divided into 52 weeks of seven days.
  • A month is defined as 4 weeks or 28 days. There are thirteen months in a year.
  • A leap year consists of 371 days with the extra "special" week of festivities tacked on to the end.
  • A year is a leap year if it is divisible by 6 or 62.
  • All years, months and weeks begin on Saturday.
Strange, but this seems vaguely familiar...

No comments:

Post a Comment