Two players, and , remove alternatively stones from a heap initially containing stones. The first to move is who takes at least one stone and at most stones. Next, each player to move has to take at least one stone and at most as many stones as his opponent took in his previous move. The winner is the player who takes the last stone. Which player has a winning strategy?
Solution
Let us label the position meaning "the player who has to move finds stones in the heap and can take at most stones".
We prove that the losing positions are those of the forms and , where , .
The initial position being , the losing initial positions are those with , i.e. the powers of . The conclusion will be that if is a power of , the second player has a winning strategy, while in the other cases, the first player has a winning strategy. Let us notice that:
- the game ends only in positions of the form
- from a position of the form , , there is no move that could leave the opponent in a position of similar form
- from any position that is not one of the above form, there exists a move that leaves the opponent in a position of the form , .
• If from , , one could move to , , that move would consist in removing stones, hence . As , it follows that , hence . Then , which contradicts . In conclusion, such a move does not exist.
Obviously, there is no move to a position either.
• From any of the remaining positions, that is with , there is a move that leaves the opponent in position , obviously a losing one. Simply take stones.
From the above, it is easy to see what the appropriate winning strategy is for the player that has such a strategy: always take stones, where is the largest power of that divides the number of the remaining stones.