[Community Puzzle] Gauss and the Stolen Numbers - Puzzle discussion

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @DeyvidNeshev,validated by @celeria,@ethan-alexander and @Delicious31415.
If you have any issues, feel free to ping them.

A bit of a nit, but test case 3 is invalid if the instructions are read carefully:

  • Instructions say N is the largest natural number written on the board.
  • In test case 3, N is given as 28
  • In test case 3, the accepted solutions are 27 and 28

If 28 is a solution, it must be missing from the numbers written on the board, yet it is explicitly defined as the largest number written on the board. So there is no valid solution for this test case.

1 Like

Thank you for reporting. I’ve just added before the disappearance to the description.

In my opinion that makes the problem

  • somewhat less realistic (we magically know `n` although it might be one of the erased numbers!?)
  • slightly less interesting to code (with n being the biggest number before the disappearance, solving this problem can be done in just one line: just write the arithmetic expression for the missing two numbers and assume it will work. if n was the biggest number remaining after the disappearance, then solving this problem requires error-checking and handling three possible cases)

The teacher originally wrote 1 to N on the board, and Gauss could easily have seen that before lunch (the statement is silent on that point). Nothing especially unrealistic is introduced by specifying the original upper bound.

  1. While it is certainly possible to solve the problem in a single line of code (excluding input reading), only one published Python solution currently does so. Conceptually, the solution still involves several distinct steps, so there remains genuine problem-solving involved, even if the task itself is elementary. After all, the puzzle is classified as Easy.

  2. Whether a puzzle is “more interesting” is ultimately a matter of taste. You may well be right that the alternative interpretation could lead to a richer reconstruction-style problem. However, I do not want to revise the published statement in a way that effectively turns it into a different puzzle from the one originally intended by the author and approved during review, especially given that 99 people have solved it at the moment. The current version is meant to be a direct algebra exercise, rather than a reconstruction puzzle involving incomplete knowledge of the range.