News for hackers. Stuff that matters.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by ykonstant on Wednesday October 30, 2024 @06:48AM (#41993535)
Another fantastic resource is Boris Kordemsky's book The Moscow Puzzles:

https://www.amazon.com/Moscow-Puzzles-Mathematical-Recreatio...

Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by I_complete_me on Wednesday October 30, 2024 @01:51PM (#41998153)
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.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by bumbledraven on Friday November 01, 2024 @03:54PM (#42020862)
I don't see it there: 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).

Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by bumbledraven on Saturday November 02, 2024 @02:37AM (#42024474)
It 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/Refe...).
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by tromp on Friday November 01, 2024 @04:49PM (#42021414)
Unless 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.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by madcaptenor on Friday November 01, 2024 @06:38PM (#42022251)
So 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.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by tromp on Saturday November 02, 2024 @04:28AM (#42024916)
But if the pair of (date, weekday) repeats every 400*7 years, then it still works out exactly?!
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by bumbledraven on Saturday November 02, 2024 @01:17PM (#42027699)
In 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....) 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

Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by tromp on Monday November 04, 2024 @06:56AM (#42040710)
Ah, 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.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by madcaptenor on Monday November 04, 2024 @10:07AM (#42042193)
Exactly.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by jeifneioka on Friday November 01, 2024 @06:44PM (#42022290)
Don't forget Raymond Smullyan.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by lanstin on Friday November 01, 2024 @11:55PM (#42023958)
The Lady and the Tiger.
Re:Math and Puzzle Fans Find Magic in Martin Gardner's Legacy by zem on Saturday November 02, 2024 @03:45AM (#42024729)
and ian stewart!