*** Welcome to piglix ***

Doomsday algorithm


The Doomsday rule or Doomsday algorithm is a way of calculating the day of the week of a given date. It provides a perpetual calendar because the Gregorian calendar moves in cycles of 400 years.

This algorithm for mental calculation was devised by John Conway after drawing inspiration from Lewis Carroll's work on a perpetual calendar algorithm. It takes advantage of each year having a certain day of the week (the doomsday) upon which certain easy-to-remember dates fall; for example, 4/4, 6/6, 8/8, 10/10, 12/12, and the last day of February all occur on the same day of the week in any given year. Applying the Doomsday algorithm involves three steps:

This technique applies to both the Gregorian calendar A.D. and the Julian calendar, although their doomsdays will usually be different days of the week.

Since this algorithm involves treating days of the week like numbers modulo 7, John Conway suggests thinking of the days of the week as "Noneday"; or as "Sansday" (for Sunday), "Oneday", "Twosday", "Treblesday", "Foursday", "Fiveday", and "Six-a-day". There are some languages, like Portuguese and Galician who base some of the names of the week days in their positional order.

The algorithm is simple enough for anyone with basic arithmetic ability to do the calculations mentally. Conway can usually give the correct answer in under two seconds. To improve his speed, he practices his calendrical calculations on his computer, which is programmed to quiz him with random dates every time he logs on.

Doomsday for the current year in the Gregorian calendar (2017) is Tuesday.

For some other contemporary years :

Notes: Fill in the table horizontally, skipping one column for each leap year. This table cycles every 28 years, except in the Gregorian calendar on years multiple of 100 (like 1900 which is not a leap year) that are not multiple of 400 (like 2000 which is still a leap year). The full cycle is 28 years (1,461 weeks) in the Julian calendar, 400 years (20,871 weeks) in the Gregorian calendar.


...
Wikipedia

...