First positive integers are written on the whiteboard. Ana and Bine are playing a game. In each move one of the players must erase 3 numbers whose average value is an integer. Ana starts and then they take turns after each move. The player that can not make a move loses. Determine who has the winning strategy and justify the answer.
Problem 1888
Official solution
In each step average value of chosen three numbers will be integer if and only if their sum will be divisible by 3. Therefore it is enough to know only residues of numbers modulo 3. Let us denote with and how many numbers on board give residue 0, 1 or 2 modulo 3, respectively.
We can present current state on the board with triple of these nonnegative integers . Possible moves in this state are
Because of symmetry of these moves order of integers in triple is not important. Therefore we will present each state rather with ordered triple , where is a permutation of with .
The sum modulo 3 is invariant after each move. We denote to be final state of the game where no moves are possible anymore. Because it must hold and . With respect to we have following possibilities:
*
Final state is (2,0,0) or (1,1,0). In either case players had to make moves together to reach this state. If this number is even Bine wins else Ana wins. Therefore if Bine wins and if Ana wins.
*
At the beginning of game we have and after each move property is invariant. Therefore final state will be . To reach it will have to be played. So if Bine wins and if Ana wins.
•
In this case final states are (2,2,0) and (1,0,0). State (2,2,0) can be reached after odd number of moves and therefore is winning for Ana. State (1,0,0) can be reached after even number of moves and therefore is winning for Bine. For Ana can make first move (3, 2, 2) (2, 2, 0) and wins.
For we will prove that Bine has winning strategy. There exist two numbers in the triplet such that in each turn they are congruent modulo 3. Bine's strategy is to decrease of these two numbers below 2. If he succeeds it will be also possible to decrease the other number below 2 and therefore final state will be (1,0,0). Starting triple is . Bine chooses one of the numbers and tries to decrease it below 2 in as few turns as possible. Ana can prevent him to do so only if at the end Bine gets number 2 and Ana in the meantime decreases number on 0. Because Bine is decreasing his number in each turn by 3 that can happen only if . That can happen because then holds and Ana needs less turns to reach 0 with decreasing by 3. In this case Bine has to adjust his strategy in his penultimate move. For the state before that move is . Then Bine must not decrease 5 by 3 but rather decrease all three numbers by 1 to reach state . In the next move Ana cannot decrease number 2 to 0 therefore Bine will be able to decrease number 4 below number 2. So Bine can definitely reach state (1,0,0) and win.
•
For Ana makes move (2, 1, 1) (1, 0, 0) and wins. For Ana makes move (4, 3, 3) (4, 3, 0). Then regardless of the move Bine makes Ana can make another move and again wins by reaching state (1, 0, 0).
For Ana can in the first move erase biggest three numbers from the board. By that the game transforms into the previous case with and . Now Ana is a second player and she has a winning strategy.
We conclude that Ana wins if and if . Otherwise Bine wins.