The Doomsday Algorithm, Explained

After reading this you will be able to name the weekday of any date from 1800 to 2099 in your head, in about ten seconds, and you will know exactly which drill to run when a step feels slow.

What the method does and one quick hook

Pick a date. Say, 2024-07-04. The Doomsday algorithm tells you it was a Thursday, without a calendar and without memorizing anything about that specific year beyond a two-digit number.

The trick, due to John Conway, rests on one observation: inside any single year, a scattered set of easy dates all land on the same weekday. That shared weekday is the year's doomsday. In 2024 the doomsday is Thursday, so 4/4, 6/6, 8/8, 10/10, 12/12, and the last day of February were all Thursdays too. Once you know the doomsday, you count a few days from the nearest anchor date to your target. That is the whole method: find one weekday for the year, then take a short step.

This trainer deals you random dates from 1800 to 2099. Practice mode shows the full worked steps after every answer. Quiz mode times ten dates and tracks your accuracy.

When this is worth learning, and when it is not

The honest case for learning it: it is a compact, self-contained skill. The full algorithm fits on an index card, and with maybe two hours of drilling spread over a week most people reach five to fifteen seconds per date. It is a genuine party trick and a good demonstration of modular arithmetic for a classroom.

The honest case against: if you only need one weekday once, a calendar app answers in one second and never errs. The method pays off when you want the mental skill itself, when you teach modular arithmetic, or when you enjoy the drill for its own sake, the way people enjoy mental multiplication.

The weekday pattern repeats exactly every 400 years, because the Gregorian calendar has 400 × 365 + 97 = 146097 days, and 146097 is divisible by 7 (it equals 20871 × 7). So the 1800s, 2200s, and 2600s share the same anchor, and so on. That is why three century anchors cover everything the trainer throws at you.

The formula and why it works

Three ingredients combine into the year's doomsday. First, a century anchor. Second, an adjustment for the two-digit year. The rule:

D = \left(A + y + \left\lfloor \frac{y}{4} \right\rfloor\right) \bmod 7

Here A is the century anchor as a number (Sunday = 0, Monday = 1, and so on), y is the two-digit year, and \lfloor y/4 \rfloor is the integer part of y divided by 4. The result D is the doomsday weekday as a number 0 through 6.

The anchors you memorize as weekdays: Friday for the 1800s, Wednesday for the 1900s, Tuesday for the 2000s. As numbers those are 5, 3, and 2.

Why the y + \lfloor y/4 \rfloor term? A common year is 365 days, and 365 mod 7 = 1, so each year shifts the weekday forward by one. That is the +y. Every leap year adds one extra day, and leap years arrive every four years, which is the +\lfloor y/4 \rfloor correction. Add both to the anchor, cast out sevens, and you have the doomsday.

Reduce modulo 7 at every stage, not just at the end. For y = 87: 87 mod 7 = 3 and 21 mod 7 = 0, so instead of adding 87 + 21 = 108 you add 3 + 0 = 3. Working with numbers below 7 is where the speed comes from.

The dates to memorize

Doomsday is only useful if you can reach it from your target date. These anchor dates are spread across the year so one is always close:

Even months
4/4, 6/6, 8/8, 10/10, 12/12. The month equals the day.
The 9-to-5 pair
5/9, 9/5, 7/11, 11/7. Remember it as "I work 9 to 5 at the 7-11".
March
3/14, pi day. Convenient and easy to recall.
February
the last day: 2/28 in common years, 2/29 in leap years.
January
the 3rd in common years, the 4th in leap years.

Notice every even month from April onward gives you a doomsday on the "month/month" date. That alone covers half the calendar.

A worked example: 4 July 2024

Reproducing the demo date step by step

Take 2024-07-04, the trainer's default, and compute its weekday.

  1. Century anchor for the 2000s is Tuesday, so A = 2.
  2. Two-digit year is y = 24. Reduce: 24 mod 7 = 3.
  3. Leap term: \lfloor 24/4 \rfloor = 6, and 6 mod 7 = 6.
  4. Add them all: 2 + 3 + 6 = 11, and 11 mod 7 = 4. Day 4 is Thursday, so the 2024 doomsday is Thursday.
  5. 2024 is a leap year, so the nearest doomsday date to 4 July is 7/11 (a Thursday). Step back from the 11th to the 4th: that is 7 days, and 7 mod 7 = 0. No shift.
  6. Therefore 4 July 2024 is also a Thursday.

You could equally count from 6/6. June 6 is a Thursday, and 4 July is 28 days later. Since 28 mod 7 = 0, again Thursday. Any anchor gives the same answer, which is a useful self-check.

How the year doomsday moves

The chart below plots the doomsday weekday (0 = Sunday through 6 = Saturday) for each year from 2000 to 2028. The line steps up by one most years and jumps by two across a leap year, then wraps around from Saturday back to Sunday. That saw-tooth is the y + \lfloor y/4 \rfloor term in action.

Each common year steps up one; leap years jump two. 2024 sits at 4, which is Thursday.

For any year you type, the doomsday equals (A + y + floor(y/4)) mod 7. Example: 1987, anchor Wednesday (3), gives 3 + (87 mod 7 = 3) + (21 mod 7 = 0) = 6, which is Saturday.

Reading your quiz results

Quiz mode reports two numbers: accuracy over ten dates, and average time per date. Read them together, not separately. Ten correct at 30 seconds each means you know the method but are still computing slowly. Seven correct at 6 seconds each means you are rushing a step, usually the leap-year adjustment.

A reasonable progression looks like this. Your first honest quiz might be 6 or 7 out of 10 at 20 to 40 seconds. After memorizing the anchor dates cold, accuracy usually climbs to 9 or 10 out of 10 while time is still high. Only then does time fall, often to the 5 to 10 second range, as the arithmetic becomes automatic. Chase accuracy first, speed second. Your best result is stored on this device only.

Rough skill stages and what to drill next
AccuracyAvg timeLikely gapDrill
6/1030 sanchor dates not memorizedflashcard the 10 dates
8/1018 sleap-year slipsJan/Feb dates only
10/1012 sslow mod arithmeticcast out sevens earlier
10/106 snone, you are fluentwiden the year range

Common mistakes

Four errors account for most wrong answers. Learn to spot each one in your own worked steps.

The biggest trap is January and February in leap years. In a leap year the January doomsday is the 4th, not the 3rd, and February's is the 29th. A leap year is one divisible by 4, except century years must be divisible by 400. So 2000 is a leap year, 1900 is not, and 2100 will not be. If your date is in January or February, decide leap-or-not before you count.

The second mistake is forgetting to reduce modulo 7 and then miscounting a large sum like 108. The third is counting the wrong direction from the anchor date; going from 7/11 to 7/4 is backward, so subtract days. The fourth is mixing up the anchors: Friday, Wednesday, Tuesday for the 1800s, 1900s, 2000s, in that order. A quick memory hook is that they step back by two each century (5, 3, 2, then wrap).

Related drills on this site

If you enjoy timed mental drills, the Mental Math Trainer exercises the same "cast out sevens" arithmetic under a clock, with a per-operation breakdown. For the raw speed component, the Reaction Time Test measures how fast you respond once you know the answer, and the N-Back Working Memory Test trains the short-term holding you use to keep the anchor and the count in mind at once.

Frequently asked questions

How fast can I realistically get?

Most people reach 5 to 15 seconds per date after two or three hours of practice. Sub-5-second times are achievable but require the anchor dates to be as automatic as your own phone number. Speed comes from arithmetic below 7, not from memorizing years.

Does it work before 1800 or after 2099?

The math works for any Gregorian date. This trainer limits itself to 1800 to 2099 so you only memorize three century anchors. Beyond that range you add more anchors (they cycle Friday, Wednesday, Tuesday, Sunday every 400 years) or handle Julian dates separately.

Why is it called "doomsday"?

Conway coined the name for the shared weekday that all the anchor dates fall on in a given year. It carries no other meaning; it is just a memorable label for "the year's reference weekday".

Do I have to memorize a weekday for every year?

No. You memorize three century anchors and ten anchor dates. The two-digit year is computed on the spot with y + \lfloor y/4 \rfloor \bmod 7. That is the point of the method: almost nothing is memorized per year.

What is the fastest way to handle the year term?

For y = 87: take 87 mod 7 = 3, then floor(87/4) = 21 and 21 mod 7 = 0, so the year term is 3. Add the anchor last. Reducing each piece before adding keeps every number under 7.