Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This was the first explanation that I immediately memorised. Thank you for sharing. I got quite a few right, but as I experimented I failed on February 7th 2032. My math was:

    Years since 2012 is 20
    Leap years is 20/4 = 5
    Magic month number = 4
    Date is 7
    (20 + 5 + 4 + 7) % 7 = 1
So I was expecting Sunday, but the answer is Saturday. After some thought I realised: 2032 is a leap year and the chosen date is before February 29th. In those cases (on or before that day), it is necessary to subtract 1.


Exactly so ...

> Leap years is 20/4 = 5

... but because you are in February you have not yet had that leap year, so it's only 4, and then the sums work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: