Problem 3. A carried path (one square wide) is infinite in both directions. Two squares on the path are traps. There are $N$ squares between the traps, and one of them is where the hopper stands. Before each hop, we choose a random natural number $X$, after which the hopper jumps $X$ squares to the left or right (at its own choice). During the game, we can see where the hopper is. For which $N$ can we choose the numbers so that we can definitely trap the hopper, no matter where it initially stood and regardless of how it chooses the directions for jumping?
Solution. We will prove that when $N=2^{k}-1$, the grasshopper can always be caught in a trap. We consider an integer numbering of the squares, where the traps have numbers 0 and $N+1$. If the grasshopper is between the traps in a square with number $x$, then the distances to the traps are equal to $x$ and $N-x$.

Let $N+1=2^{k}$. We will show that if before each jump we choose a number equal to the distance $d$ to the nearest trap, the grasshopper will be caught in a trap. Since $d \in\left[1,2^{k-1}-1\right]$, the highest power of two that divides $d$ is less than $k-1$. If the grasshopper jumps in the direction opposite to the nearest trap, it will remain between the traps (since the other trap is farther away). The new distances to the traps are $2d$ and $2^{k}-2d$, both of which are divisible by a higher power of two than $d$. By continuing this process, we will reach a moment when both distances are divisible by $2^{k}$, which means they are 0 and $2^{k}$, i.e., the grasshopper has fallen into a trap.

Let $N+1=2^{k} t$, where $t$ is an odd number greater than 1 (the power $k$ can be equal to 0). We will call traps all squares with numbers that are multiples of $t$. If at any moment the grasshopper is not in a trap, then it is not in the middle between two traps (the middle between traps $at$ and $bt$ is $\frac{(a+b)t}{2}$, which is either a trap or not an integer). This means that with any number we choose, the grasshopper can make a jump, avoiding the trap.

Thus, we have proved that only when $N$ is of the form $2^{k}-1$ do we have a strategy for catching the grasshopper.

Comment. Most participants noticed that when $N=2^{k}-1$, the grasshopper can be caught in a trap. For the completeness of the solution, it must also be explained why in other cases the grasshopper has a saving strategy.