2 ms·
It indeed isn't a particularly difficult algorithm. It's just modulo 7 arithmetic and some divisions combined with a table lookup. Martin Gardner of course co
by JdeBP 7y ago
It indeed isn't a particularly difficult algorithm. It's just modulo 7 arithmetic and some divisions combined with a table lookup. Martin Gardner of course covered it. I first encountered it in Shakuntala Devi's book Figuring: The Joy of Numbers, which has a slightly different lookup table. With practice, one can run it as the date is being given, a common lightning calculator trick for making things faster, and the lookup table becomes directly memorized. In practice, the algorithm is rarely applied outwith the past 400 years or even the past 100, for obvious reasons. Tweaking for the century is an afterthought in several accounts that I've read over the years.
- ColinWright 7y agoThere are at least two algorithms. The one you outline here feels more like the one I use (and, coincidentally, Art Benjamin[0][1][2] uses), whereas Conway used one of his own devising called the Doomsday Algorithm[3]. So you're right, it's not that hard, but be aware that you may not be thinking of the algorithm Conway used. [0] https://en.wikipedia.org/wiki/Arthur_T._Benjamin https://en.wikipedia.org/wiki/Arthur_T._Benjamin [1] https://math.hmc.edu/benjamin/ https://math.hmc.edu/benjamin/ [2] https://www.ted.com/talks/arthur_benjamin_a_performance_of_mathemagic https://www.ted.com/talks/arthur_benjamin_a_performance_of_m... [3] https://en.wikipedia.org/wiki/Doomsday_rule https://en.wikipedia.org/wiki/Doomsday_rule