5 ms·
I think it was this book where I first saw the puzzle: Does New Year's Day fall more often on a Saturday or a Sunday? Such a simple puzzle with to (then)
by I_complete_me 2y ago
I think it was this book where I first saw the puzzle:
Does New Year's Day fall more often on a Saturday or a Sunday?
Such a simple puzzle with to (then) me such depth of knowledge to uncover the answer.
- bumbledraven 2y agoI don't see it there: https://archive.org/details/boris-a.-kordemsky-the-moscow-puzzles-1972/ https://archive.org/details/boris-a.-kordemsky-the-moscow-pu... Do you recall the solution? It seems like a tricky problem. No approach occurs to me aside from a brute force analysis of the 400 year Gregorian calendar cycle, accounting for the complete leap year rules (under which, e.g., 1900 was not a leap year but 2000 was).
- bumbledraven 2y agoIt turns out that New Year's Day is a bit more likely to fall on Sunday than Saturday. To confirm, here's a bit of simple JavaScript that checks a complete 400-year cycle. You can run it in your browser's console: const counts = Array(7).fill(0); for (let year = 2000; year < 2400; year++) { counts[new Date(year, 0, 1).getDay()]++; } console.log(`Number of Saturdays: ${counts[6]}; Number of Sundays: ${counts[0]}`); Output: Number of Saturdays: 56; Number of Sundays: 58 Note: getDay() returns 0 for Sunday and 6 for Saturday (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...).
- tromp 2y agoUnless you're considering a limited date range, it should fall equally often on both in the limit since neither 365 nor 366 (leap year) are multiples of 7.
- deleted 2y ago[deleted]
- madcaptenor 2y agoSo you’d think that, and it is approximately true. But the calendar repeats every 400 years (there are 97 leap years in 400, and 497 is a multiple of 7). And 400 isn’t a multiple of 7, so you can’t have it work out exactly.
- tromp 2y agoBut if the pair of (date, weekday) repeats every 400*7 years, then it still works out exactly?!
- bumbledraven 2y agoIn the Gregorian calendar, January 1 falls on a Saturday in any year that is a multiple of 400. (This follows from any correct day-of-the-week algorithm, such as https://firstsundaydoomsday.blogspot.com/2009/12/quick-start-guide.html https://firstsundaydoomsday.blogspot.com/2009/12/quick-start....) Since each 400-year cycle begins on the same day, rather than balancing out, any imbalances would actually accumulate. To check, see this 5-line brute-force calculation in JavaScript: https://news.ycombinator.com/item?id=42024474 https://news.ycombinator.com/item?id=42024474
- tromp 2y agoAh, the number of days in 400 years is 400 * 365 + 97 = (57*7+1) * (52*7+1) + (14*7-1) = 0 mod 7, so indeed it doesn't work out.
- madcaptenor 2y agoExactly.