This was a thing I did for a high school number theory assignment, which I then turned into a JavaScript program.
(I wrote this in terms of pencil-and-paper arithmetic; my intent at the time was to make it in a similar style to certain "math magic" things, where it was like, do this long series of operations and then suddenly I can figure out your number. I'm not sure if I succeeded in that, and I'm not sure this is the clearest or more efficient way to do this.)
(Note: this does not work for really old dates because they didn't use a calendar with leap years back then.)
Your number | Friday 13 in these months |
---|---|
0 | January (except leap years), October |
1 | January (leap year only), April, July |
2 | September, December |
3 | June |
4 | February (except leap years), March, November |
5 | February (leap year only), August |
6 | May |