# Doomsday rule

Doomsday rule

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 since the Gregorian calendar moves in cycles of 400 years.

This algorithm for mental calculation was devised by John Conway[1][2] after drawing inspiration from Lewis Carroll’s work on a perpetual calendar algorithm.[3][4] It takes advantage of the fact that each year has 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:

1. Determine the “anchor day” for the century.
2. Use the anchor day for the century to calculate the doomsday for the year.
3. Choose the closest date out of the ones that always fall on the doomsday (e.g. 4/4, 6/6, 8/8), and count the number of days (modulo 7) between that date and the date in question to arrive at the day of the week.
Written on August 6, 2012