|
|
|
|
|
by kseistrup
2362 days ago
|
|
I really like the “2053” pattern, it's easy to remember. But I doubt I will be able to remember the rest. I think I'd rather do like this: Given a year CCXX, we know the doomsday of year CC00 from the “2053“ rule, and then: (a, b) = divmod(XX, 12)
c = b // 4
offset = a + b + c
Then add the offset to the day found by the “2053” rule, and you have the doomsday of the year.E.g., for 2020 we have: start = 2 # from the 2053 rule
(a, b) = divmod(20, 12) # (1, 8)
c = 8 // 4 # 2
offset = 1 + 8 + 2 = 4 (mod 7)
doomsday = 2 + 4 = 6 # saturday
|
|