Alice and Bob play the following game: They start with two non-empty piles of coins. Taking turns, with Alice playing first, they choose a pile with an even number of coins and move half of the coins of this pile to the other pile. The game ends if a player cannot move, or if we reach a previously reached position. In the first case, the player who cannot move loses. In the second case, the game is declared a draw.
Determine all pairs of positive integers such that if initially the two piles have and coins respectively, then Bob has a winning strategy.
(Cyprus)
Problem 536
Official solution
By we denote the largest nonnegative integer such that .
A position (i.e. two piles of sizes and ) is said to be -happy if for some integer , and -unhappy if , then .
Hence a -unhappy position is winning for Alice if is odd, and drawing if is even.