Doomsday rule
The Doomsday rule, also known as the Doomsday algorithm, is a mnemonic-based method developed by British mathematician John Horton Conway in the 1970s to determine the day of the week for any given date in the Gregorian calendar.[1][2] It relies on identifying a recurring "doomsday" weekday for each year—shared by specific memorable dates in each month—and uses modular arithmetic modulo 7 to compute shifts from century anchor days.[1][3] This approach allows mental calculation of weekdays in seconds, making it a practical tool for calendar computations without external references.[1] Conway's method simplifies and popularizes an earlier algorithm published by Lewis Carroll (Charles Lutwidge Dodgson) in 1887, which used more cumbersome perpetual calendar techniques but achieved similar results through division and remainders.[3] The core process begins with century anchor days—such as Wednesday for the 1900s and Tuesday for the 2000s—derived from the Gregorian calendar's 400-year cycle of 146,097 days, equivalent to exactly 20,871 weeks (0 modulo 7).[1][2] For a given year, the doomsday is found by taking the last two digits y, computing y + \lfloor y/4 \rfloor modulo 7, and adding it to the century anchor, with adjustments for leap years every four years (except century years not divisible by 400).[2][3] Once the year's doomsday is established, monthly "doomsdays" serve as reference points, such as the last day of February (or 29th in leap years), 4/4 for April, 6/6 for June, 8/8 for August, 10/10 for October, 12/12 for December, 5/9 for May (or 9/5), 9/5 for September (or 5/9), 11/7 for November (or 7/11), and 7/11 for July (or 11/7); even months use their date number, while odd months except January and February follow the "9/5, 5/9, 11/7, 7/11" rhyme.[1] To find a specific date's weekday, one counts the days from the nearest doomsday reference forward or backward, adjusting modulo 7 from the known doomsday weekday (where Sunday = 0, Monday = 1, up to Saturday = 6).[1][2] For example, in 1978 (doomsday Tuesday), February 11 falls 17 days before February 28 (a doomsday), so 17 mod 7 = 3, shifting Tuesday back 3 days yields Saturday.[1] The rule's elegance lies in its reliance on easy-to-memorize patterns, enabling rapid verification of historical events or future dates, though it requires initial practice to master the anchors and references.[3]Fundamentals
Concept of doomsday
The doomsday in the context of the Doomsday rule refers to a specific day of the week that occurs on a set of predetermined, easy-to-remember dates within any given year, known as anchor dates. These anchors include the last day of February (or February 29 in leap years), as well as the dates 4/4, 6/6, 8/8, 10/10, and 12/12.[4] Additional anchors, such as 5/9, 9/5, 7/11, and 11/7, further facilitate reference points throughout the year.[4] This consistent alignment allows the doomsday to serve as a reliable pivot for the entire calendar. The primary purpose of identifying the doomsday is to streamline the determination of the day of the week for any date by first establishing this single reference point for the year, from which other dates can be calculated through simple counting. Since days of the week repeat in a cycle of seven, the offset between a target date and the nearest anchor can be computed modulo 7 to find the corresponding weekday efficiently.[5] This approach reduces complex calendar arithmetic to mental shortcuts, making it accessible without tools or extensive memorization. The Doomsday rule, including the concept of the doomsday, was invented by British mathematician John Horton Conway in 1973 as a quick technique for mental date calculations, inspired by earlier perpetual calendar methods but simplified for practical use.[4] Conway, renowned for contributions like the Game of Life cellular automaton, developed it to enable rapid weekday computations, often demonstrating it in lectures and interviews.[4]Doomsday anchors
In the Doomsday rule for the Gregorian calendar, anchor dates serve as fixed reference points within each month that always fall on the year's doomsday, facilitating efficient mental navigation to other dates. For the even-numbered months, the standard anchors are April 4, June 6, August 8, October 10, and December 12; these are selected because the day number matches the month number, providing a simple mnemonic for recall.[6] For the odd-numbered months, the anchors deviate from the month-day equality to maintain consistency with the calendar's structure: March 7 (or equivalently the 14th, 21st, or 28th), May 9, July 11, September 5, and November 7. Alternative representations include 5/9 for May, 9/5 for September, 7/11 for July, and 11/7 for November, emphasizing the interchangeable options for these months.[6] May's anchor on the 9th exemplifies this adjustment for odd months.[6] The anchor for February is the last day of the month—February 28 in common years or February 29 in leap years—positioning it as a pivotal reference near the year's start. In leap years, February 29 functions as a universal check point aligned with the doomsday. January's anchors are January 3 in common years and January 4 in leap years, derived directly from the February anchor to ensure continuity across the year-end transition.[6] These anchors are chosen for their numerical ease and even distribution throughout the year, enabling users to count forward or backward in increments of 7 days to reach any target date with minimal effort, while respecting the Gregorian calendar's leap year insertions.[6]Calculating the Year's Doomsday
Gregorian calendar methods
The primary method for calculating the doomsday weekday in the Gregorian calendar, as devised by John Conway, involves determining a century anchor, computing a year code from the last two digits of the year, and then adjusting for the leap year status when applying to specific dates.[7] This approach simplifies the underlying modular arithmetic of the calendar's 400-year cycle into memorable steps suitable for mental computation. Century anchors provide the base doomsday for the "00" year of each century, represented numerically where Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6. The anchors repeat every 400 years due to the Gregorian leap year rules. A common table of anchors, derived from Conway's algorithm, is as follows:| Century Range | Anchor Day (Numeric Code) |
|---|---|
| 1600–1699 | 2 (Tuesday) |
| 1700–1799 | 0 (Sunday) |
| 1800–1899 | 5 (Friday) |
| 1900–1999 | 3 (Wednesday) |
| 2000–2099 | 2 (Tuesday) |
| 2100–2199 | 0 (Sunday) |
Julian calendar adaptation
The Doomsday rule adapts straightforwardly to the Julian calendar, which lacks the Gregorian system's century-based leap year exceptions, resulting in a simpler but less astronomically precise structure. In the Julian calendar, leap years occur every four years without exception, meaning an additional day is added consistently for such years when calculating doomsdays for dates after February.[10] This uniform rule simplifies the leap year adjustment to adding 1 to the doomsday calculation for post-February dates in divisible-by-4 years, avoiding the Gregorian's variable century corrections.[5] The core formula for determining the year's doomsday in the Julian calendar mirrors the Gregorian approach but omits century corrections, yielding doomsday = (YY + ⌊YY/4⌋ + (6 * CC mod 7)) mod 7, where YY represents the two-digit year and CC the century number.[5] Century anchors are adjusted accordingly, shifting by 3 days from their Gregorian equivalents due to the inclusion of every century year as a leap year, which accumulates extra days over time (Julian has 3 more leap days per 400 years). For instance, the anchor for the 1900s in Julian reckoning falls on Tuesday (2), compared to Wednesday (3) in Gregorian.[9] This adaptation proves particularly useful for historical dates before the Gregorian reform in 1582 or in regions that delayed adoption, such as Russia until February 1918 and Greece until February 1923.[10][11] When converting between calendars, the day offset varies—starting at 10 days post-1582 and increasing to 13 days by the 20th century—but doomsdays must be computed independently using the respective calendar's rules to accurately determine the weekday.[11]Applying the Rule to Specific Dates
Memorable date mnemonics
The Doomsday rule employs specific memorable dates, known as doomsdays, for each month of the year to facilitate quick recall of the weekday anchor for any given year. For the even-numbered months from April to December, these dates follow a simple pattern where the month number equals the day number: April 4 (4/4), June 6 (6/6), August 8 (8/8), October 10 (10/10), and December 12 (12/12).[12][2] This n/n format provides an intuitive mnemonic for these months.[2] For the odd-numbered months, excluding January, February, and March, the doomsdays are September 5 (9/5), May 9 (5/9), July 11 (7/11), and November 7 (11/7). These can be remembered using the phrase "I work from 9 to 5 at the 7-11," which evokes a standard workday schedule at a convenience store chain, linking the numbers to the respective month-day pairs.[5][12][2] January and February have doomsdays adjusted for leap years. In a common year, January 3 and the last day of February (February 28, or "March 0") are doomsdays; in a leap year, these shift to January 4 and February 29.[12][2] For March, common memorable dates include March 7 or March 14 (Pi Day), aligning with the February end reference.[2] Other culturally notable dates like July 4 (Independence Day) or October 31 (Halloween) can also function as doomsdays when they fall on the appropriate weekday, enhancing practical recall.[12][2]Step-by-step day-of-week determination
To determine the day of the week for a specific date using the Doomsday rule, begin with the weekday of the year's doomsday, which has been previously calculated. Identify an anchor date for the target month, such as one of the memorable dates like 4/4 for April or 9/5 for September. Compute the offset as the difference in days between the target date and the anchor date, taken modulo 7; add this offset to the doomsday weekday (or subtract if negative, adjusting modulo 7) to obtain the target date's weekday.[5][2] For a target date D/M (day D of month M) where the anchor is A/M, the offset is given by (D - A) \mod 7. If the target date precedes the anchor, subtract the absolute difference and add 7 if necessary to keep the result positive. Adjustments may be needed for month transitions, such as when the target date is in a different week relative to the anchor, but the modulo 7 operation ensures the correct weekday shift. These anchors are selected to be close to common dates, minimizing calculation effort.[5] January and February require special handling due to leap year effects. Although the year's doomsday calculation treats these months as the 13th and 14th of the prior year to account for the leap day shift, the anchors for specific dates use January 3 (non-leap) or 4 (leap), and February 28 (non-leap) or 29 (leap). For dates in these months, select the appropriate anchor based on the year's leap status and apply the offset as usual.[2][5] In leap years, February 29 always falls on the doomsday weekday, serving as a direct reference without offset. Century years follow standard Gregorian rules for leap status (divisible by 400), which influences the anchors for January and February but does not alter the offset process once the year's doomsday is established.[5]Mathematical Foundations
Why the rule works
The Doomsday rule relies on the fundamental periodicity of the week, which cycles every 7 days, allowing all date calculations to be performed using modular arithmetic modulo 7. In the Gregorian calendar, a common year has 365 days, equivalent to 52 weeks and 1 extra day (365 ≡ 1 mod 7), advancing the doomsday by 1 day of the week from the previous year. A leap year has 366 days (≡ 2 mod 7), advancing it by 2 days. These annual advances accumulate over years, and the rule computes the doomsday—the weekday shared by specific "anchor" dates—by determining the total such advances modulo 7 from a reference epoch.[3] The formula for the doomsday derives from counting the total number of days elapsed since a fixed reference epoch (such as the year 1900 or 2000) modulo 7, which directly yields the weekday offset. This total incorporates both regular days and leap day adjustments, with the Gregorian leap year rules (every 4 years, except century years not divisible by 400) ensuring alignment with the solar year. Over a 400-year cycle, the calendar contains 400 × 365 + 97 leap days = 146,097 days, which is exactly divisible by 7 (146,097 ≡ 0 mod 7), confirming the cycle's repetition without weekday drift.[3][13] All computations in the rule operate modulo 7 to simplify tracking these offsets. The century terms in the formula account for the three skipped leap years every 400 years (in century years like 1700, 1800, and 1900), which would otherwise overcount leap days by 3 (≡ 3 mod 7), shifting the anchor accordingly. For instance, the anchor for the 1900s is Tuesday, reflecting the cumulative effect of prior skipped leaps from an earlier epoch.[3] A key component is the year code within a century, approximated as YY + \left\lfloor \frac{YY}{4} \right\rfloor \mod 7, where YY is the last two digits of the year. This expression estimates the days from the century's start to the year's start modulo 7: the YY term captures the regular day advances (since 365 ≡ 1 mod 7), while \left\lfloor \frac{YY}{4} \right\rfloor counts the leap days contributed by years divisible by 4 within the century (ignoring century-specific skips, which are handled separately). To see why, note that the total days are $365 \times YY + \left\lfloor \frac{YY}{4} \right\rfloor \equiv YY + \left\lfloor \frac{YY}{4} \right\rfloor \mod 7, providing an exact modular representation for non-century years. Conway's mental variant (using divisions by 12 and adjustments) is equivalent modulo 7, facilitating computation without a calculator.[3]400-year cycle and subcycles
The Gregorian calendar's doomsday pattern repeats precisely every 400 years, encompassing 146,097 days, which equals exactly 20,871 weeks with no remainder. This exact alignment of days to weeks ensures that the anchor days and overall weekly structure recur identically after 400 years, forming a complete cycle for doomsday calculations.[14] Within this 400-year framework, the century anchor days follow a predictable progression, advancing by specific intervals due to the cumulative leap year adjustments. For example, the block from 2000 to 2399 begins with a Tuesday anchor, mirroring 1600–1699, and the pattern continues cyclically thereafter.[9][1] A key subcycle within the 400-year period is the 28-year repetition, where doomsdays often align due to 28 years containing an integer number of weeks aligned with leap years—10,220 base days plus 7 extra leap days in the Julian system, totaling 10,227 days or 1,461 weeks exactly.[15] In the Julian calendar, this 28-year cycle is uninterrupted and exact, as every fourth year is a leap year without century exceptions, allowing seamless repetition of the doomsday across centuries.[16] However, in the Gregorian calendar, the 28-year subcycle is generally reliable within a single century but interrupted at century years not divisible by 400 (such as 1700, 1800, or 1900), which are not leap years despite being divisible by 4; this omission shifts the doomsday by an extra day compared to the expected pattern, breaking the chain until the next aligned 28-year segment.[15] These exceptions ensure the overall 400-year synchronization but require adjustments in cross-century doomsday computations.Related Concepts and Variations
Correspondence to dominical letters
The dominical letter system, derived from ancient Roman calendar practices and adopted by early Christian chronologers, labels the days of the year with repeating letters A through G to identify Sundays for liturgical purposes. In this scheme, January 1 is always assigned letter A, January 2 letter B, and so on through January 7 as G, after which the cycle repeats; the dominical letter for the year is the specific letter that corresponds to the first Sunday.[17] Historically, dominical letters facilitated the alignment of movable feasts like Easter in prayer books and perpetual calendars by allowing quick identification of Sundays without full day-of-week computations, a practice essential for regulating the church year before modern algorithms. The letter shifts backward by one position each common year (e.g., from A to G) and by two positions in leap years due to the extra day in February, which advances all subsequent Sundays by one day relative to the calendar dates.[17] The Doomsday rule, developed by mathematician John Horton Conway, connects directly to this system by using the year's doomsday—the weekday shared by key "anchor" dates—as a single reference point to derive the dominical letter via fixed modular offsets. For instance, in common years of the 1900s (where the century anchor is Wednesday), a doomsday falling on Tuesday corresponds to dominical letter F, reflecting the alignment of January dates with Sundays. Pre-Conway methods relied on tracking multiple letters across the year, whereas the Doomsday approach streamlines this to one weekday determination for all Sundays. The precise mapping between the doomsday weekday and dominical letter follows a standard correspondence, accounting for the structure of January 1–7:| Doomsday Weekday | Common Year Letter | Leap Year Letters |
|---|---|---|
| Sunday | C | DC |
| Monday | B | CB |
| Tuesday | A | BA |
| Wednesday | G | AG |
| Thursday | F | GF |
| Friday | E | FE |
| Saturday | D | ED |
Alternative formulas
One notable alternative to Conway's mnemonic-based Doomsday rule is the formula proposed by Hirofumi Nakai for directly computing the weekday of the year's Doomsday, designed for straightforward mental arithmetic using only remainders modulo 4 and multiplications by small constants.[18] This approach avoids the need to memorize century anchors or year codes, instead relying on simple divisions and adjustments within the Gregorian calendar.[18] Nakai's formula calculates the Doomsday weekday g(n) for a year n = 100c + y, where c is the century number and y is the year within the century (00 to 99), as follows: g(n) = \left[ 5(c_2 + y_2 - 1) + 10y \right] \mod 7 Here, c_2 = c \mod 4 and y_2 = y \mod 4, with weekdays numbered 0 for Sunday through 6 for Saturday.[18] The formula implicitly accounts for leap years through the century and year adjustments, and once the Doomsday is found, the weekday for any date is determined by adding the offset from that date to the month's Doomsday (e.g., March 7 or 14).[18] For example, to find the Doomsday for 1984 (c = 19, y = 84): c_2 = 19 \mod 4 = 3, y_2 = 84 \mod 4 = 0, so g(1984) = [5(3 + 0 - 1) + 10 \times 84] \mod 7 = [10 + 840] \mod 7 = 850 \mod 7 = 3, corresponding to Wednesday (a leap year, where Doomsday falls on the 4th of even months after February).[18] This calculation involves basic multiplication and modulo operations, taking seconds mentally.[18] Unlike Conway's method, which emphasizes memorable dates and modular additions, Nakai's is more algebraic and direct for the annual anchor, though it still requires knowing month offsets for full dates; it sacrifices mnemonic flair for reduced memorization of codes.[18] Other variants include earlier perpetual calendar formulas, such as Lewis Carroll's 1887 method, which computes the weekday via summed items for century (e.g., $2 \times ((3 - (c \mod 4)) \mod 4)), year (dozens plus remainder plus leaps), month (cumulative days), and day, modulo 7—suitable for mental use but more step-heavy.[19] Spreadsheet implementations often adapt these into single-cell formulas, like Excel's=MOD(DAY + MONTH_OFFSET + YEAR_CODE + CENTURY_CODE, 7), for automated verification without mental effort.
These alternatives are particularly useful for programming perpetual calendars or double-checking mental results, where arithmetic precision trumps mnemonic speed, though they may feel less intuitive for pure head computation compared to Conway's approach.[18]