Johan and Quintijn play the following game.
Before the start of the game, the integers , , , are written on a board. The players then each take turns, starting with Johan. On their turn a player must wipe out two integers and from the board and write their (possibly negative) difference on the board. The game ends when only one integer is left on the board. If this integer is divisible by , Johan wins, otherwise Quintijn wins.
Determine which of the two players has a winning strategy.
Solution
We show that Quintijn has a winning strategy.
Observe that each move reduces the number of integers by exactly one, so at the start of Johan's turn the number is always even and at the start of Quintijn's turn the number is always odd. Moreover, the number must be at least , otherwise the game would have already ended. In particular, at the start of Quintijn's turn, the number of integers is always at least .
Note Johan cannot reach a position in which unless at the start of his turn either and , or and (or and ) hold. In particular, if at the start of his turn at least one of and is odd, then he cannot reach a position in which .
First suppose that and are both even. Then at least one of and must be at least , say . Since Quintijn always has an odd number of integers left at the start of his turn, there must also be an integer on the board that is divisible by . With , Quintijn ensures that decreases by and increases by , so and both become odd.
Now suppose that at least one of and are odd. If there exists an with , then performing any move will not change the parity of and , so at least one of them remains odd. Otherwise all so there are at most integers left, and in fact we must have equality here as there are always at least integers left at the start of Quintijn's turn. So , hence Quintijn can perform the move .
Therefore Quintijn can always make a move that causes at least one of and to be odd. Now the strategy of making such a move is winning for Quintijn, as by following this strategy, Quintijn will never create a position in which and are both , and Johan can never create such a position from any position that Quintijn may leave behind; the same must hold for the final position in which one integer remains, so this remaining integer must not be divisible by , meaning that Quintijn wins.