Skip to main content
OlympiadHQ

Browse · MathNet

Print

60th Belarusian Mathematical Olympiad

Belarus counting and probability

Problem

There is a heap of stones. Nick and Mary play the following game. They, in turn (Mary is the first), remove the stones from the heap. Per move it is allowed to remove exactly or exactly or exactly stones. The player wins if he/she removes the last stone. Before the start Nick fixes the value of (). After that Mary fixes the value of () and begins the game. Can somebody of the players fix his/her number to win if both of them play to win? (V. Kaskevich)
Solution
Nick wins if he sets . We consider all possibilities for . Let . If Mary removes stones then Nick removes . In this case exactly stones are removed from the heap after each pair of moves (Mary - Nick). Since , Nick wins.

Now we will solve the problem moving backward. We write all numbers from to and mark them with "+" or "-". If stones remain in the heap before the move of a player and he/she can win, then we write , otherwise we write . For we have the following table

| +1 | +2 | -3 | +4 | +5 | -6 | +7 | +8 | -9 | +10 | +11 | -12 | +13 | +14 | -15 | +16 | ... |

We see that the signs in the table are repeated with the period equaled (it is easy to prove by induction). Since it follows that is marked with the sign "-". Thus the number is the losing number of the stones for the beginning player.

For we have the table

| +1 | +2 | -3 | +4 | +5 | +6 | -7 | +8 | +9 | -10 | +11 | +12 | +13 | -14 | ... | | 1 | 2 | - | 1 | 2 | 6 | - | 1 | 2 | - | 1 | 2 | 6 | - | ... |

The second row of the table contains the possible winning moves (to win the player can remove so many stones that after his move the number of the stones remained in the heap would be marked with "+"). We see that the signs in the first row of the table are repeated with the period equaled (it is easy to prove by induction). Since is congruent to modulo , it follows that and are marked with the same sign, i.e. "-". Thus the number is the losing number of the stones for the beginning player. To win Nick can remove so many stones as it is written in the second row of the table.

In a similar way, for we have the table

| +1 | +2 | -3 | +4 | +5 | -6 | +7 | +8 | +9 | -10 | | 1 | 2 | - | 1 | 2 | - | 1 | 2 | 9 | - |

| +11 | +12 | -13 | +14 | +15 | -16 | +17 | +18 | +19 | -20 | ... | | 1 | 2 | - | 1 | 2 | - | 1 | 2 | 9 | - | ... |

The second row of the table contains the possible winning moves (to win the player can remove so many stones that after his move the number of the stones remained in the heap would be marked with "+"). We see that the signs in the first row of the table are repeated with the period equaled (it is easy to prove by induction). Since is divided by , it follows that and are marked with the same sign, i.e. "-". Thus the number is the losing number of the stones for the beginning player. To win Nick can remove so many stones as it is written in the second row of the table.
Final answer
Nick can guarantee a win by choosing n = 2.

Techniques

Games / greedy algorithmsInduction / smoothingInvariants / monovariants