You can get from the year to the doomsday by a simpler formula:
If odd, add 11; divide by 2; if odd, add 11. Count up to nearest multiple of 7
So e.g. 1955 turns into 66 turns into 33 turns into 44 turns into 5. Add that to 4 for the century (1900 is 4, 2000 is 3, that's all you really need to memorize) and you get 9, so the doomsday for 1955 is Monday.
From there it's simple, 4/4 6/6 8/8 10/10 12/12, 9/5 7/11 per the mnemonic mentioned, last day of February, Jan 3/4 depending on leap year, and March 7 counting forward from February.
There, that's the entire algorithm.
For years other than the centuries, we need to add an offset. Given the year CCXX, we have:
(a, b) = divmod(XX, 12)
c = b // 4
offset = a + b + c
doomsday = start + offset
E.g., for 2020 (XX == 20) we get: start = 2 # from the "2053" rule
(a, b) = divmod(20, 12) # (1, 8)
c = b // 4 # 2
offset = 1 + 8 + 2 = 4 (mod 7)
doomsday = start + offset # 2 + 4 = 6 = saturdayWith both divide by 12 and odd 11, I would find myself occasionally making a goof when dealing with years near the end of centuries.
It is. I remember this being one of my programming assignments in college. Another one is determining whether a year is a leap year.
It also still requires a lookup to bootstrap it: the day-of-week of the last day of February for the selected year. So it's a clever and well-observed compilation of identified patterns, but not self-contained.