Doomsday rule

Last updated
John Conway, inventor of the Doomsday algorithm John H Conway 2005.jpg
John Conway, inventor of the Doomsday algorithm

The Doomsday rule, Doomsday algorithm or Doomsday method is an algorithm of determination of the day of the week for a given date. It provides a perpetual calendar because the Gregorian calendar moves in cycles of 400 years. The algorithm for mental calculation was devised by John Conway in 1973, [1] [2] drawing inspiration from Lewis Carroll's perpetual calendar algorithm. [3] [4] [5] It takes advantage of each year having a certain day of the week upon which certain easy-to-remember dates, called the doomsdays, fall; for example, the last day of February, 4/4, 6/6, 8/8, 10/10, and 12/12 all occur on the same day of the week in any year.

Contents

Applying the Doomsday algorithm involves three steps: determination of the anchor day for the century, calculation of the anchor day for the year from the one for the century, and selection of the closest date out of those that always fall on the doomsday, e.g., 4/4 and 6/6, and count of the number of days (modulo 7) between that date and the date in question to arrive at the day of the week. The technique applies to both the Gregorian calendar and the Julian calendar, although their doomsdays are usually different days of the week.

The algorithm is simple enough that it can be computed mentally. Conway could usually give the correct answer in under two seconds. To improve his speed, he practiced his calendrical calculations on his computer, which was programmed to quiz him with random dates every time he logged on. [6]

Anchor days for some contemporary years

Doomsday's anchor day for the current year in the Gregorian calendar (2024) is Thursday. For some other contemporary years:

Days with the Doomsday rule for years from 1800 through 2100
Years during which a Doomsday rule
occurs in the day to the right
Day with
its Doomsday rule
Year length
and weekday of
January the 1st
Year's
dominical
letter
1802, 1813, 1819, 1824, 1830, 1841, 1847, 1852, 1858, 1869, 1875, 1880, 1886, 1897, 1909, 1915, 1920, 1926, 1937, 1943, 1948, 1954, 1965, 1971, 1976, 1982, 1993, 1999, 2004, 2010, 2021, 2027, 2032, 2038, 2049, 2055, 2060, 2066, 2077, 2083, 2088, 2094 and 2100.Sunday 365: Friday
366: Thursday
C
DC
1803, 1808, 1814, 1825, 1831, 1836, 1842, 1853, 1859, 1864, 1870, 1881, 1887, 1892, 1898, 1904, 1910, 1921, 1927, 1932, 1938, 1949, 1955, 1960, 1966, 1977, 1983, 1988, 1994, 2005, 2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089 and 2095.Monday 365: Saturday
366: Friday
B
CB
1809, 1815, 1820, 1826, 1837, 1843, 1848, 1854, 1865, 1871, 1876, 1882, 1893, 1899, 1905, 1911, 1916, 1922, 1933, 1939, 1944, 1950, 1961, 1967, 1972, 1978, 1989, 1995, 2000, 2006, 2017, 2023, 2028, 2034, 2045, 2051, 2056, 2062, 2073, 2079, 2084 and 2090.Tuesday 365: Sunday
366: Saturday
A
BA
1804, 1810, 1821, 1827, 1832, 1838, 1849, 1855, 1860, 1866, 1877, 1883, 1888, 1894, 1900, 1906, 1917, 1923, 1928, 1934, 1945, 1951, 1956, 1962, 1973, 1979, 1984, 1990, 2001, 2007, 2012, 2018, 2029, 2035, 2040, 2046, 2057, 2063, 2068, 2074, 2085, 2091 and 2096.Wednesday 365: Monday
366: Sunday
G
AG
1805, 1811, 1816, 1822, 1833, 1839, 1844, 1850, 1861, 1867, 1872, 1878, 1889, 1895, 1901, 1907, 1912, 1918, 1929, 1935, 1940, 1946, 1957, 1963, 1968, 1974, 1985, 1991, 1996, 2002, 2013, 2019, 2024, 2030, 2041, 2047, 2052, 2058, 2069, 2075, 2080, 2086 and 2097.Thursday 365: Tuesday
366: Monday
F
GF
1800, 1806, 1817, 1823, 1828, 1834, 1845, 1851, 1856, 1862, 1873, 1879, 1884, 1890, 1902, 1913, 1919, 1924, 1930, 1941, 1947, 1952, 1958, 1969, 1975, 1980, 1986, 1997, 2003, 2008, 2014, 2025, 2031, 2036, 2042, 2053, 2059, 2064, 2070, 2081, 2087, 2092 and 2098.Friday 365: Wednesday
366: Tuesday
E
FE
1801, 1807, 1812, 1818, 1829, 1835, 1840, 1846, 1857, 1863, 1868, 1874, 1885, 1891, 1896, 1903, 1908, 1914, 1925, 1931, 1936, 1942, 1953, 1959, 1964, 1970, 1981, 1987, 1992, 1998, 2009, 2015, 2020, 2026, 2037, 2043, 2048, 2054, 2065, 2071, 2076, 2082, 2093 and 2099.Saturday 365: Thursday
366: Wednesday
D
ED

The table is filled in horizontally, skipping one column for each leap year. This table cycles every 28 years, except in the Gregorian calendar on years that are a multiple of 100 (such as 1900 and 2100 which are not leap years) that are not also a 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 Doomsday

One can 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.

The last day of February is always a doomsday. For January, 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 year". For March, one can remember either Pi Day or "March 0", the latter referring to the day before March 1, i.e. the last day of February.

For the months April through December, the even numbered months are covered by the double dates 4/4, 6/6, 8/8, 10/10, and 12/12, all of which fall on the doomsday. The odd numbered months can be remembered with the mnemonic "I work from 9 to 5 at the 7-11", i.e., 9/5, 7/11, and also 5/9 and 11/7, are all doomsdays (this is true for both the Day/Month and Month/Day conventions). [7]

Several well-known dates, such as Independence Day in United States, Boxing Day, and Valentine's Day in common years, also fall on doomsdays every year. The chart below includes only the mnemonics covered in the sources listed.

MonthMemorable dateMonth/DayMnemonic [8] [7] [9] Complete list of days
JanuaryJanuary 3 (common years),
January 4 (leap years)
1/3 OR 1/4 (1/31 OR 1/32)the 3rd 3 years in 4 and the 4th in the 4th [9] (or: last day of January, pretending leap years have a January 32nd [7] )3, 10, 17, 24, 31 OR4, 11, 18, 25, 32 [7]
FebruaryFebruary 28 (common years), February 29 (leap years)2/0 OR 2/1 (2/28 OR 2/29)last day of January, pretending leap years have a January 32nd [7] (or: last day of February)0, 7, 14, 21, 28OR1, 8, 15, 22, 29
March"March 0," March 143/0 AND 3/14last day of February, Pi Day 0, 7, 14, 21, 28
AprilApril 44/44/4, 6/6, 8/8, 10/10, 12/124, 11, 18, 25
MayMay 95/9 9-to-5 at 7-11 2, 9, 16, 23, 30
JuneJune 66/64/4, 6/6, 8/8, 10/10, 12/126, 13, 20, 27
JulyJuly 117/119-to-5 at 7-114, 11, 18, 25
AugustAugust 88/84/4, 6/6, 8/8, 10/10, 12/121, 8, 15, 22, 29
SeptemberSeptember 59/59-to-5 at 7-115, 12, 19, 26
OctoberOctober 1010/104/4, 6/6, 8/8, 10/10, 12/123, 10, 17, 24, 31
NovemberNovember 711/79-to-5 at 7-117, 14, 21, 28
DecemberDecember 1212/124/4, 6/6, 8/8, 10/10, 12/125, 12, 19, 26

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.

MonthMDoomsday
Jan13/4C/LC/D
Feb20/1
Mar37/0M + 4C day
May59
Jul711
Sep95M − 4
Nov117
Jan139/2B day
Apr44MC day
Jun66
Aug88
Oct1010
Dec1212
Feb1413/−1M − 1B day

January and February can be treated as the last two months of the previous year.

Example

To find which day of the week Christmas Day of 2021 is, proceed as follows: in the year 2021, doomsday is on Sunday. Since December 12 is a doomsday, December 25, being thirteen days afterwards (two weeks less a day), fell on a Saturday. Christmas Day is always the day of the week before doomsday. In addition, July 4 (U.S. Independence Day) is always on the same day of the week as a doomsday, as are Halloween (October 31), Pi Day (March 14), and December 26 (Boxing Day).

Mnemonic weekday names

Since this algorithm involves treating days of the week like numbers modulo 7, John Conway suggested thinking of the days of the week as "Noneday" or "Sansday" (for Sunday), "Oneday", "Twosday", "Treblesday", "Foursday", "Fiveday", and "Six-a-day" in order to recall the number-weekday relation without needing to count them out in one's head. [10]

day of weekIndex
number
Mnemonic
Sunday0Noneday or
Sansday
Monday1Oneday
Tuesday2Twosday
Wednesday3Treblesday
Thursday4Foursday
Friday5Fiveday
Saturday6Six-a-day

There are some languages, such as Slavic languages, Chinese, Greek, Portuguese, Galician and Hebrew, that base some of the names of the week days in their positional order. The Slavic and Chinese agree with the table above; the other languages mentioned count from Sunday as day one.

Finding a year's anchor day

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 1600–1699, 1700–1799, 1800–1899, 1900–1999, 2000–2099, 2100–2199 and 2200–2299.

CenturyAnchor dayMnemonicIndex (day of week)
1600-1699Tuesday2 (Twoday)
1700-1799Sunday0 (Noneday)
1800–1899Friday5 (Fiveday)
1900–1999WednesdayWe-in-dis-day
(most living people were born in that century)
3 (Treblesday)
2000–2099TuesdayY-Tue-K or Twos-day
(Y2K was at the head of this century)
2 (Twosday)
2100–2199SundayTwenty-one-day is Sunday
(2100 is the start of the next century)
0 (Noneday)
2200–2299Friday5 (Fiveday)

For the Gregorian calendar:

Mathematical formula
5 × (c mod 4) mod 7 + Tuesday = anchor.
Algorithmic
Let r = c mod 4
if r = 0 then anchor = Tuesday
if r = 1 then anchor = Sunday
if r = 2 then anchor = Friday
if r = 3 then anchor = Wednesday

For the Julian calendar:

6c mod 7 + Sunday = anchor.

Note: .

Next, find the year's anchor day. To accomplish that according to Conway: [11]

  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 y plus the floor of y 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 one.

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 works

Doomsday rule Doomsday Rule.svg
Doomsday rule

The doomsday's anchor day 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 + y/4 (rounded down). But 365 equals 52 × 7 + 1, so after taking the remainder we get just

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 gives the same answer as in the example above.

Where 12 comes in is that the pattern of almost repeats every 12 years. After 12 years, we get . If we replace y by y mod 12, we are throwing this extra day away; but adding back in compensates for this error, giving the final formula.

For calculating the Gregorian anchor day of a century: three “common centuries” (each having 24 leap years) are followed by a “leap century” (having 25 leap years). A common century moves the doomsday forward by

days (equivalent to two days back). A leap century moves the doomsday forward by 6 days (equivalent to one day back).

So c centuries move the doomsday forward by

,

but this is equivalent to

.

Four centuries move the doomsday forward by

;

so four centuries form a cycle that leaves the doomsday unchanged (and hence the “mod 4” in the century formula).

The "odd + 11" method

A simple flowchart showing the Odd+11 method to calculate the anchor day Odd+11 doomsday flowchart.svg
A simple flowchart showing the Odd+11 method to calculate the anchor day

A simpler method for finding the year's anchor day was discovered in 2010 by Chamberlain Fong and Michael K. Walters, [12] and described in their paper submitted to the 7th International Congress on Industrial and Applied Mathematics (2011). Called the "odd + 11" method, it is equivalent [12] 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. Furthermore, addition by 11 is very easy to perform mentally in base-10 arithmetic.

Extending this to get the anchor day, the procedure is often described as accumulating a running total T in six steps, as follows:

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

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

  1. T = 5
  2. T = 5 + 11 = 16 (adding 11 because T is odd)
  3. T = 16/2 = 8
  4. T = 8 (do nothing since T is even)
  5. T = 7 − (8 mod 7) = 7 − 1 = 6
  6. Doomsday for 2005 = 6 + Tuesday = Monday

The explicit formula for the odd+11 method is:

.

Although this expression looks daunting and complicated, it is actually simple [12] because of a common subexpression y + 11(y mod 2)/2 that only needs to be calculated once.

Anytime adding 11 is needed, subtracting 17 yields equivalent results. While subtracting 17 may seem more difficult to mentally perform than adding 11, there are cases where subtracting 17 is easier, especially when the number is a two-digit number that ends in 7 (such as 17, 27, 37, ..., 77, 87, and 97).

Correspondence with dominical letter

Doomsday is related to the dominical letter of the year as follows.

DoomsdayDominical letter
Common yearLeap year
SundayCDC
MondayBCB
TuesdayABA
WednesdayGAG
ThursdayFGF
FridayEFE
SaturdayDED

Look up the table below for the dominical letter (DL).

Hundreds of YearsD
L
Remaining Year Digits#
Julian
(r ÷ 7)
Gregorian
(r ÷ 4)
r5191620r0A00 06 17 2328 34 45 5156 62 73 7984 900
r41815 19 r3G01 07 12 1829 35 40 4657 63 68 7485 91 961
r317N/AF02 13 19 2430 41 47 5258 69 75 8086 972
r21618 22 r2E03 08 14 2531 36 42 5359 64 70 8187 92 983
r115N/AD 09 15 20 26 37 43 48 54 65 71 76 82 93 994
r01417 21 r1C04 10 21 2732 38 49 5560 66 77 8388 945
r613N/AB05 11 16 2233 39 44 5061 67 72 7889 956

For the year 2024, the dominical letter is BA + 2 = GF.

Overview of all Doomsdays

MonthDatesWeek numbers *
January (common years)3, 10, 17, 24, 311–5
January (leap years)4, 11, 18, 251–4
February (common years)7, 14, 21, 286–9
February (leap years)1, 8, 15, 22, 295–9
March7, 14, 21, 2810–13
April4, 11, 18, 2514–17
May2, 9, 16, 23, 3018–22
June6, 13, 20, 2723–26
July4, 11, 18, 2527–30
August1, 8, 15, 22, 2931–35
September5, 12, 19, 2636–39
October3, 10, 17, 24, 3140–44
November7, 14, 21, 2845–48
December5, 12, 19, 2649–52

* In leap years the nth doomsday is in ISO week n. In common years the day after the nth doomsday is in week n. Thus in a common year the week number on the doomsday itself is one less if it is a Sunday, i.e. in a common year starting on Friday.

Computer formula for the anchor day of a year

For computer use, the following formulas for the anchor day of a year are convenient.

For the Gregorian calendar:

For example, the doomsday 2009 is Saturday under the Gregorian calendar (the currently accepted calendar), since

As another example, the doomsday 1946 is Thursday, since

For the Julian calendar:

The formulas apply also for the proleptic Gregorian calendar and the proleptic Julian calendar. They use the floor function and astronomical year numbering for years BC.

For comparison, see the calculation of a Julian day number.

400-year cycle of anchor days

Julian centuries-1600J
-900J
-200J
500J
1200J
1900J
2600J
3300J
-1500J
-800J
-100J
600J
1300J
2000J
2700J
3400J
-1400J
-700J
0J
700J
1400J
2100J
2800J
3500J
-1300J
-600J
100J
800J
1500J
2200J
2900J
3600J
-1200J
-500J
200J
900J
1600J
2300J
3000J
3700J
-1100J
-400J
300J
1000J
1700J
2400J
3100J
3800J
-1000J
-300J
400J
1100J
1800J
2500J
3200J
3900J
Gregorian
centuries

  Years
-1600
-1200
-800
-400
0
400
800
1200
1600
2000
2400
2800
3200
3600
-1500
-1100
-700
-300
100
500
900
1300
1700
2100
2500
2900
3300
3700
-1400
-1000
-600
-200
200
600
1000
1400
1800
2200
2600
3000
3400
3800
-1300
-900
-500
-100
300
700
1100
1500
1900
2300
2700
3100
3500
3900
00285684Tue.Mon.Sun.Sat.Fri.Thu.Wed.
01295785Wed.Tue.Mon.Sun.Sat.Fri.Thu.
02305886Thu.Wed.Tue.Mon.Sun.Sat.Fri.
03315987Fri.Thu.Wed.Tue.Mon.Sun.Sat.
04326088Sun.Sat.Fri.Thu.Wed.Tue.Mon.
05336189Mon.Sun.Sat.Fri.Thu.Wed.Tue.
06346290Tue.Mon.Sun.Sat.Fri.Thu.Wed.
07356391Wed.Tue.Mon.Sun.Sat.Fri.Thu.
08366492Fri.Thu.Wed.Tue.Mon.Sun.Sat.
09376593Sat.Fri.Thu.Wed.Tue.Mon.Sun.
10386694Sun.Sat.Fri.Thu.Wed.Tue.Mon.
11396795Mon.Sun.Sat.Fri.Thu.Wed.Tue.
12406896Wed.Tue.Mon.Sun.Sat.Fri.Thu.
13416997Thu.Wed.Tue.Mon.Sun.Sat.Fri.
14427098Fri.Thu.Wed.Tue.Mon.Sun.Sat.
15437199Sat.Fri.Thu.Wed.Tue.Mon.Sun.
164472Mon.Sun.Sat.Fri.Thu.Wed.Tue.
174573Tue.Mon.Sun.Sat.Fri.Thu.Wed.
184674Wed.Tue.Mon.Sun.Sat.Fri.Thu.
194775Thu.Wed.Tue.Mon.Sun.Sat.Fri.
204876Sat.Fri.Thu.Wed.Tue.Mon.Sun.
214977Sun.Sat.Fri.Thu.Wed.Tue.Mon.
225078Mon.Sun.Sat.Fri.Thu.Wed.Tue.
235179Tue.Mon.Sun.Sat.Fri.Thu.Wed.
245280Thu.Wed.Tue.Mon.Sun.Sat.Fri.
255381Fri.Thu.Wed.Tue.Mon.Sun.Sat.
265482Sat.Fri.Thu.Wed.Tue.Mon.Sun.
275583Sun.Sat.Fri.Thu.Wed.Tue.Mon.

Since in the Gregorian calendar there are 146,097 days, or exactly 20,871 seven-day weeks, in 400 years, the anchor day repeats every four centuries. For example, the anchor day of 1700–1799 is the same as the anchor day of 2100–2199, i.e. Sunday.

The full 400-year cycle of doomsdays is given in the adjacent table. The centuries are for the Gregorian and proleptic Gregorian calendar, unless marked with a J for Julian. The Gregorian leap years are highlighted.

Negative years use astronomical year numbering. Year 25BC is −24, shown in the column of −100J (proleptic Julian) or −100 (proleptic Gregorian), at the row 76.

Frequency of Gregorian Doomsday in the 400-year cycle per weekday and year type
SundayMondayTuesdayWednesdayThursdayFridaySaturdayTotal
Non-leap years43434343444344303
Leap years1315131513141497
Total56585658575758400

A leap year with Monday as doomsday means that Sunday is one of 97 days skipped in the 400-year sequence. Thus the total number of years with Sunday as doomsday is 71 minus the number of leap years with Monday as doomsday, etc. Since Monday as doomsday is skipped across 29 February 2000 and the pattern of leap days is symmetric about that leap day, the frequencies of doomsdays per weekday (adding common and leap years) are symmetric about Monday. The frequencies of doomsdays of leap years per weekday are symmetric about the doomsday of 2000, Tuesday.

The frequency of a particular date being on a particular weekday can easily be derived from the above (for a date from 1 January – 28 February, relate it to the doomsday of the previous year).

For example, 28 February is one day after doomsday of the previous year, so it is 58 times each on Tuesday, Thursday and Sunday, etc. 29 February is doomsday of a leap year, so it is 15 times each on Monday and Wednesday, etc.

28-year cycle

Regarding the frequency of doomsdays in a Julian 28-year cycle, there are 1 leap year and 3 common years for every weekday, the latter 6, 17 and 23 years after the former (so with intervals of 6, 11, 6, and 5 years; not evenly distributed because after 12 years the day is skipped in the sequence of doomsdays).[ citation needed ] The same cycle applies for any given date from 1 March falling on a particular weekday.

For any given date up to 28 February falling on a particular weekday, the 3 common years are 5, 11, and 22 years after the leap year, so with intervals of 5, 6, 11, and 6 years. Thus the cycle is the same, but with the 5-year interval after instead of before the leap year.

Thus, for any date except 29 February, the intervals between common years falling on a particular weekday are 6, 11, 11. See e.g. at the bottom of the page Common year starting on Monday the years in the range 1906–2091.

For 29 February falling on a particular weekday, there is just one in every 28 years, and it is of course a leap year.

Julian calendar

The Gregorian calendar is currently accurately lining up with astronomical events such as solstices. In 1582 this modification of the Julian calendar was first instituted. In order to correct for calendar drift, 10 days were skipped, so doomsday moved back 10 days (i.e. 3 days): Thursday 4 October (Julian, doomsday is Wednesday) was followed by Friday 15 October (Gregorian, doomsday is Sunday). The table includes Julian calendar years, but the algorithm is for the Gregorian and proleptic Gregorian calendar only.

Note that the Gregorian calendar was not adopted simultaneously in all countries, so for many centuries, different regions used different dates for the same day.

Full examples

Example 1 (1985)

Suppose we want to know the day of the week of September 18, 1985. We begin with the century's anchor day, Wednesday. To this, add a, b, and c above:

This yields a + b + c = 8. Counting 8 days from Wednesday, we reach Thursday, which is the doomsday in 1985. (Using numbers: In modulo 7 arithmetic, 8 is congruent to 1. Because the century's anchor day is Wednesday (index 3), and 3 + 1 = 4, doomsday in 1985 was Thursday (index 4).) We now compare September 18 to a nearby doomsday, September 5. We see that the 18th is 13 past a doomsday, i.e. one day less than two weeks. Hence, the 18th was a Wednesday (the day preceding Thursday). (Using numbers: In modulo 7 arithmetic, 13 is congruent to 6 or, more succinctly, −1. Thus, we take one away from the doomsday, Thursday, to find that September 18, 1985 was a Wednesday.)

Example 2 (other centuries)

Suppose that we want to find the day of week that the American Civil War broke out at Fort Sumter, which was April 12, 1861. The anchor day for the century was 94 days after Tuesday, or, in other words, Friday (calculated as 18 × 5 + ⌊18/4; or just look at the chart, above, which lists the century's anchor days). The digits 61 gave a displacement of six days so doomsday was Thursday. Therefore, April 4 was Thursday so April 12, eight days later, was a Friday.

See also

Related Research Articles

In mathematics and computer programming, exponentiating by squaring is a general method for fast computation of large positive integer powers of a number, or more generally of an element of a semigroup, like a polynomial or a square matrix. Some variants are commonly referred to as square-and-multiply algorithms or binary exponentiation. These can be of quite general use, for example in modular arithmetic or powering of matrices. For semigroups for which additive notation is commonly used, like elliptic curves used in cryptography, this method is also referred to as double-and-add.

In number theory, the Legendre symbol is a multiplicative function with values 1, −1, 0 that is a quadratic character modulo of an odd prime number p: its value at a (nonzero) quadratic residue mod p is 1 and at a non-quadratic residue (non-residue) is −1. Its value at zero is 0.

<span class="mw-page-title-main">Triangle wave</span> Non-sinusoidal waveform

A triangular wave or triangle wave is a non-sinusoidal waveform named for its triangular shape. It is a periodic, piecewise linear, continuous real function.

<span class="mw-page-title-main">Floor and ceiling functions</span> Nearest integers from a number

In mathematics, the floor function (or greatest integer function) is the function that takes as input a real number x, and gives as output the greatest integer less than or equal to x, denoted x or floor(x). Similarly, the ceiling function maps x to the smallest integer greater than or equal to x, denoted x or ceil(x).

In computer programming, a bitwise operation operates on a bit string, a bit array or a binary numeral at the level of its individual bits. It is a fast and simple action, basic to the higher-level arithmetic operations and directly supported by the processor. Most bitwise operations are presented as two-operand instructions where the result replaces one of the input operands.

Dominical letters or Sunday letters are a method used to determine the day of the week for particular dates. When using this method, each year is assigned a letter depending on which day of the week the year starts. The Dominical letter for the current year 2024 is GF.

In statistics, a k-thpercentile, also known as percentile score or centile, is a score below which a given percentage k of scores in its frequency distribution falls or a score at or below which a given percentage falls. Percentiles are expressed in the same unit of measurement as the input scores, not in percent; for example, if the scores refer to human weight, the corresponding percentiles will be expressed in kilograms or pounds. In the limit of an infinite sample size, the percentile approximates the percentile function, the inverse of the cumulative distribution function.

The determination of the day of the week for any date may be performed with a variety of algorithms. In addition, perpetual calendars require no calculation by the user, and are essentially lookup tables. A typical application is to calculate the day of the week on which someone was born or a specific event occurred.

In recreational mathematics, a Keith number or repfigit number is a natural number in a given number base with digits such that when a sequence is created such that the first terms are the digits of and each subsequent term is the sum of the previous terms, is part of the sequence. Keith numbers were introduced by Mike Keith in 1987. They are computationally very challenging to find, with only about 100 known.

In number theory, a formula for primes is a formula generating the prime numbers, exactly and without exception. Formulas for calculating primes do exist, however, they are computationally very slow. A number of constraints are known, showing what such a "formula" can and cannot be.

<span class="mw-page-title-main">Perpetual calendar</span> Calendar designed to look up the day of the week for a given date

A perpetual calendar is a calendar valid for many years, usually designed to look up the day of the week for a given date in the past or future.

Zeller's congruence is an algorithm devised by Christian Zeller in the 19th century to calculate the day of the week for any Julian or Gregorian calendar date. It can be considered to be based on the conversion between Julian day and the calendar date.

In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another.

In number theory, the law of quadratic reciprocity, like the Pythagorean theorem, has lent itself to an unusually large number of proofs. Several hundred proofs of the law of quadratic reciprocity have been published.

The ISO week date system is effectively a leap week calendar system that is part of the ISO 8601 date and time standard issued by the International Organization for Standardization (ISO) since 1988 and, before that, it was defined in ISO (R) 2015 since 1971. It is used (mainly) in government and business for fiscal years, as well as in timekeeping. This was previously known as "Industrial date coding". The system specifies a week year atop the Gregorian calendar by defining a notation for ordinal weeks of the year.

<span class="mw-page-title-main">Ordinal date</span> Date written as number

An ordinal date is a calendar date typically consisting of a year and an ordinal number, ranging between 1 and 366, representing the multiples of a day, called day of the year or ordinal day number. The two parts of the date can be formatted as "YYYY-DDD" to comply with the ISO 8601 ordinal date format. The year may sometimes be omitted, if it is implied by the context; the day may be generalized from integers to include a decimal part representing a fraction of a day.

The digital root of a natural number in a given radix is the value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached. For example, in base 10, the digital root of the number 12345 is 6 because the sum of the digits in the number is 1 + 2 + 3 + 4 + 5 = 15, then the addition process is repeated again for the resulting number 15, so that the sum of 1 + 5 equals 6, which is the digital root of that number. In base 10, this is equivalent to taking the remainder upon division by 9, which allows it to be used as a divisibility rule.

A calendrical calculation is a calculation concerning calendar dates. Calendrical calculations can be considered an area of applied mathematics. Some examples of calendrical calculations:

In computer science, multiply-with-carry (MWC) is a method invented by George Marsaglia for generating sequences of random integers based on an initial set from two to many thousands of randomly chosen seed values. The main advantages of the MWC method are that it invokes simple computer integer arithmetic and leads to very fast generation of sequences of random numbers with immense periods, ranging from around to .

In modular arithmetic, Barrett reduction is a reduction algorithm introduced in 1986 by P.D. Barrett.

References

  1. John Horton Conway, "Tomorrow is the Day After Doomsday" (PDF). Eureka. October 1973. p. 28-32.
  2. Richard Guy, John Horton Conway, Elwyn Berlekamp : "Winning Ways: For Your Mathematical Plays, Volume. 2: Games in Particular", pages 795–797, Academic Press, London, 1982, ISBN   0-12-091102-7.
  3. Lewis Carroll, "To Find the Day of the Week for Any Given Date", Nature, March 31, 1887. doi : 10.1038/035517a0
  4. Martin Gardner, The Universe in a Handkerchief: Lewis Carroll's Mathematical Recreations, Games, Puzzles, and Word Plays, pages 24–26, Springer-Verlag, 1996.
  5. "What Day is Doomsday". Mathematics Awareness Month. April 2014.
  6. Alpert, Mark. "Not Just Fun and Games", Scientific American, April, 1999. doi : 10.1038/scientificamerican0499-40
  7. 1 2 3 4 5 Torrence, Bruce; Torrence, Eve. "John H. Conway - Doomsday, part 1". YouTube. Mathematical Association of America. Archived from the original on 2021-12-21. Retrieved 14 April 2020.
  8. "The Doomsday Algorithm - Numberphile". YouTube . Retrieved 9 July 2023.
  9. 1 2 Limeback, Rudy (3 January 2017). "Doomsday Algorithm" . Retrieved 27 May 2017.
  10. "On what day of the week is Christmas? Use the Doomsday Rule". The Irish Times. Retrieved 2022-07-20.
  11. John Horton Conway, "Tomorrow is the Day After Doomsday" (PDF). Eureka. October 1973. p. 29-30. Each ordinary year has its Doomsday 1 day later than the previous year, and each leap year 2 days later. It follows that within any given century a dozen years advances Doomsday by 12 + 3 = 15 days = 1 day. ('A dozen years is but a day.') So we add to the Doomsday for the century year the number of dozens of years thereafter, the remainder, and the number of fours in the remainder.
  12. 1 2 3 Chamberlain Fong, Michael K. Walters: "Methods for Accelerating Conway's Doomsday Algorithm (part 2)", 7th International Congress on Industrial and Applied Mathematics (2011).