DEV Community

Lucian (LKB)
Lucian (LKB)

Posted on Originally published at lkforge.com

What Weekday Is Your Birthday, Really? The Calendar Is Quietly Biased

You'd expect a date to fall on each of the seven weekdays about equally often. It doesn't —
and it can't. The Gregorian calendar runs in an exact 400-year cycle, and 400 isn't
divisible by 7, so every fixed date has weekdays it prefers and weekdays it avoids. Because
the cycle is exact, these aren't estimates from a big sample — they're the permanent,
countable truth of the calendar.

Why the calendar is exact

400 years contains exactly 146,097 days, and 146,097 ÷ 7 = 20,871 — a whole number of
weeks. The leap rule (every 4th year, except centuries not divisible by 400) gives 97 leap
years per 400
, so the average year is exactly 365.2425 days. Land on a whole number of
weeks and the entire mapping of dates-to-weekdays resets: the calendar for any year is
identical to the one 400 years earlier. That's what makes the counts below exact rather than
statistical.

New Year's Day is a Sunday more than a Monday

Count every 1 January across one full cycle and the weekdays don't come out even:

  • Sunday, Tuesday, Friday — 58 times each
  • Wednesday, Thursday — 57
  • Monday, Saturday — 56 times

A perfectly even split would be 57.14 per weekday, which is impossible with 400 occurrences and
7 weekdays. The gap is small — but it never averages out, because 400 years is the whole
calendar. There's no larger sample coming.

Every date has its own favourite weekdays

The tilt isn't uniform. Where a date sits relative to February and the leap-day machinery
changes which weekdays it leans toward. US Independence Day (July 4) leans the opposite way
from New Year's — its common weekdays are Monday, Wednesday and Saturday.
And a tidy
consequence of seven-day spacing: Christmas and the New Year's Day a week later always share a
weekday
(25 December + 7 days = 1 January), so their distributions are identical, just shifted
a year.

Leap day: 97, not 100 — and rarest on a Sunday

The cycle has 97 leap years, not 100: the Gregorian rule drops three century leap days (1700,
1800 and 1900 were common years; 2000 kept its) to hold the average year at 365.2425 days. So 29
February appears just 97 times in 400 years, and even those aren't even — it lands on a Sunday
least often
and on a Monday or Wednesday most. A Sunday leap-day birthday is the rarest slice of
an already rare cake.

Your calendar comes back every 6 or 11 years

You don't have to wait 400 years to reuse a calendar. A whole year's calendar returns as soon as
two things line up again: the weekday it starts on, and whether it's a leap year. In the current
era those matches arrive in a 6-, 11- and 28-year rhythm. 2025's exact calendar returns in
2031, 2042, 2053 and 2059.
So the dusty wall calendar in the drawer really is reusable — you
just have to catch it on the right year.

Reproduce it

No dependencies, no randomness — just the weekday of each date summed over one 400-year cycle,
using Sakamoto's algorithm:

const T = [0,3,2,5,0,3,5,1,4,6,2,4]           // 0 = Sunday … 6 = Saturday
function dow(y, m, d) {
  if (m < 3) y -= 1
  return (y + (y/4|0) - (y/100|0) + (y/400|0) + T[m-1] + d) % 7
}
// count dow(y, 1, 1) for y = 2000..2399  ->  New Year's Day per weekday
Enter fullscreen mode Exit fullscreen mode

Any 400 consecutive years give the same counts — that's the whole point. To check your own dates,
the date calculator,
yearly calendar and
leap-year calculator all run in the browser.

Originally published on LK Forge.

Top comments (0)