Skip to content

Instantly share code, notes, and snippets.

@dungsaga
dungsaga / Hirofumi-Nakai-Improved.md
Last active February 22, 2026 21:33
Hirofumi Nakai Improved (HNI) - a method for Doomsday calculation

Hirofumi Nakai Improved

The Doomsday rule was devised by John Conway in 1973 to compute the day of week in your head (https://en.wikipedia.org/wiki/Doomsday_rule). Others have made improvements for easier mental calculation.

Currently, the simplest one is published in 2023 in the paper "A Simple Formula for Doomsday" by Hirofumi Nakai (https://thatsmaths.com/2023/06/22/a-simple-formula-for-the-weekday/).

  • split the year into century part and the remaining 2-digit part: Y = 100c + y
  • compute the modulo 4 of these 2 parts: c₄ = c % 4, y₄ = y % 4
  • the Doomsday would be (5(c₄ + y₄ - 1) + 10y) % 7