# Doomsday algorithm

427pages on
this wiki

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 Horton Conway after drawing inspiration from Lewis Carroll's work on a perpetual calendar algorithm. 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 (mod 7) between that date and the date in question to arrive at the day of the week.

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 "Sansday" (for Sunday), "Oneday", "Twosday", "Treblesday", "Foursday", "Fiveday", and "Six-a-day".

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.

## Doomsdays for some contemporary yearsEdit

Doomsday for the current year in the Gregorian calendar (2015) is Saturday.

For some other contemporary years:

Doomsdays for the Gregorian calendar
Mon. Tue. Wed. Thu. Fri. Sat. Sun. Mon. Tue. Wed. Thu. Fri. Sat. Sun.
1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982
1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993
1994 1995 1996 1997 1998 1999
Mon. Tue. Wed. Thu. Fri. Sat. Sun. Mon. Tue. Wed. Thu. Fri. Sat. Sun.
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021
2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032
2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043

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.

## Memorable dates that always land on DoomsdayEdit

One can easily find the day of the week of a given calendar date by using a nearby Doomsday as a reference point. To help with this, the following is a list of easy-to-remember dates for each month that always land on the Doomsday.

As mentioned above, the last day of February always falls on the doomsday, as do the double dates 4/4, 6/6, 8/8, 10/10, and 12/12. Four of the odd month dates (May 9, September 5, July 11, and November 7) can be remembered with the mnemonic "I work from 9 to 5 at the 7-11." For March, one can remember the pseudo-date "March 0", which refers to the day before March 1, i.e. the last day of February; one can alternately remember the date a week later, March 7, or March 21 which is often the first day of spring in the northern hemisphere and the first day of fall in the southern hemisphere. For January, January 11 is a Doomsday during leap years, while January 10 is a Doomsday during common years; January 3 is a doomsday during common years and January 4 a Doomsday during leap years, which can be remembered as "the 3rd during 3 years in 4, and the 4th in the 4th".

Month Memorable date Month/Day Mnemonic
January January 3, January 10, January 17, January 24, January 31 (common years)

January 4, January 11, January 18, January 25, "January 32" (leap years)

1/3 or 1/4

1/10 or 1/11

1/17 or 1/18

1/24 or 1/25

1/31 or 1/32

the 3rd 3 years in 4 and the 4th in the 4th

1 year, 0 extra days and 1 year, 1 extra day/all ones

month 1, the 7th 7 years in 8 and month 1, the 8th in the 8th

eighth to last day of January (pretend there are 32 days of January in a leap year)

last day of January (pretend there are 32 days of January in a leap year)

February "February 0", February 7, February 14, February 21, February 28 (common years),

February 1, February 8, February 15, February 22, February 29 (leap years)

2/0 or 2/1

2/7 or 2/8

2/14 or 2/15

2/21 or 2/22

2/28 or 2/29

0 or 1 extra

the 7th 7 years in 8 and the 8th in the 8th

fifteenth to last day of February

month 2, 1 sextile and month 2, 2 sextiles

last day of February

March "March 0"

March 7

March 21

3/0

3/21

last day of February

one week after the last day of February

often first day of spring in the northern hemisphere and first day of fall in the southern hemisphere

April April 4 4/4 even month
May May 9 5/9 9-to-5 at 7-11
June June 6

June 20

6/6 even month

seldom first day of summer in the northern hemisphere and first day of winter in the southern hemisphere

July July 11 7/11 9-to-5 at 7-11
August August 8 8/8 even month
September September 5 9/5 9-to-5 at 7-11
October October 10 10/10 even month
November November 7 11/7 9-to-5 at 7-11
December December 12 12/12 even month

Since the Doomsday for a particular year is directly related to weekdays of dates in the period from March through February of the next year, common years and leap years have to be distinguished for January and February of the same year.

### ExamplesEdit

Suppose you want to know which day of the week Christmas Day of 2006 was. In the year 2006, Doomsday was Tuesday. Since December 12 is a Doomsday, December 25, being thirteen days afterwards (two weeks less a day), fell on a Monday.

It's useful to note that Christmas Day is always the day before Doomsday ("One off Doomsday"). In addition, July 4 is always on a Doomsday, and so is Halloween.

Suppose that you want to find the day of week that the September 11, 2001 attacks on the World Trade Center occurred. The century anchor was Tuesday, and Doomsday for 2001 is one day beyond, which is Wednesday. September 5 was a Doomsday, and September 11, six days later, fell on a Tuesday.

## Finding a year's DoomsdayEdit

We first take the anchor day for the century. For the purposes of the Doomsday rule, a century starts with '00 and ends with '99. The following table shows the anchor day of centuries 1800–1899, 1900–1999, 2000–2099 and 2100–2199.</p>

Century Anchor day Mnemonic Index (day of week)
1800–1899 Friday - 5 (Fiveday)
1900–1999 Wednesday We-in-dis-day

(most living people were born in that century)

3 (Treblesday)
2000–2099 Tuesday Y-Tue-K or Twos-day

(Y2K was at the head of this century)

2 (Twosday)
2100–2199 Sunday Twenty-one-day is Sunday

(2100 is the start of the next century)

0 (Noneday)

Next, we find the year's Doomsday. To accomplish that according to Conway:

1. Divide the year's last two digits (call this y) by 12 and let a be the floor of the quotient.
2. Let b be the remainder of the same quotient.
3. Divide that remainder by 4 and let c be the floor of the quotient.
4. Let d be the sum of the three numbers (d = a + b + c). (It is again possible here to divide by seven and take the remainder. This number is equivalent, as it must be, to the sum of the last two digits of the year taken collectively plus the floor of those collective digits divided by four.)
5. Count forward the specified number of days (d or the remainder of d/7) from the anchor day to get the year's Doomsday.

For the twentieth-century year 1966, for example:

As described in bullet 4, above, this is equivalent to:

So Doomsday in 1966 fell on Monday.

Similarly, Doomsday in 2005 is on a Monday:

### Why it worksEdit

The doomsday calculation is effectively calculating the number of days between any given date in the base year and the same date in the current year, then taking the remainder modulo 7. When both dates come after the leap day (if any), the difference is just 365y plus y/4 (rounded down). But 365 equals 52*7+1, so after taking the remainder we get just:$(y+\left\lfloor \frac{y}{4}\right\rfloor)$ This gives a simpler formula if one is comfortable dividing large values of y by both 4 and 7. For example, we can compute $(66+\left\lfloor \frac{66}{4}\right\rfloor)\mod 7=(66+16)\mod 7=82\mod 7=5$, which gives the same answer as in the example above.

This gives a simpler formula if one is comfortable dividing large values of y by both 4 and 7. For example, we can compute , which gaves the same answer as in the example above.

Where 12 comes in is that the pattern of $(y+\left\lfloor \frac{y}{4}\right\rfloor)$ almost repeats every 12 years. After 12 years, we get (12 + 12/4) mod 7 = 15 mod 7 = 1. If we replace y by y mod 12, we are throwing this extra day away; but adding back in \left\lfloor \frac{y}{12}\right\rfloor compensates for this error, giving the final formula.

### The Odd+11 methodEdit

A simpler method for finding the year's doomsday was discovered in 2010. Called the Odd+11 method, it has been proved equivalent to computing

It is well suited to mental calculation, because it requires no division by 4 (or 12), and the procedure is easy to remember because of its repeated use of the "odd+11" rule.

The procedure accumulates a running total T as follows:

1. Let T be the year's last two digits.
2. If T is odd, add 11.
3. Let T = T/2.
4. If T is odd, add 11.
5. Let T = 7 − (T mod 7).
6. Count forward T days from the anchor day to get the year's Doomsday.

Applying this method to the year 1966, for example, the steps as outlined would be:

1. T = 66
2. T = 66 (Do nothing since T is even.)
3. T = 66/2 = 33
4. T = 33+11 = 44 (Add 11 because T is odd.)
5. T = 7 − (44 mod 7) = 7 − 2 = 5
6. Doomsday 1966 = 5 + Wednesday = Monday