# Empty one pile of balls and win

Puzzling Asked by Tharindu Sathischandra on May 8, 2021

There are two piles of balls. One contains 5 balls and the other contains 18 balls.

A and B are playing the following game:
In each round, a player has to move balls from the larger pile to the smaller pile such that the number moved was a non-zero multiple of how many were previously in the smaller pile. A starts, and A and B alternate until a pile of balls is empty. The person who emptied it is the winner.

Who will win this game?

A moves 5 balls over, which leaves piles of 10-13.

The only legal move for B is moving 10, leaving 20-3.

A responds by moving 9, leaving 11-12.

The only legal move for B is moving 11, leaving 22-1.

A moves all 22 balls, leaving 0-23.

Correct answer by Zerris on May 8, 2021

The total number of balls always remains 23, a prime number, meaning:

1. Being left with only 1 ball in the smaller pile is the only way to immediately win.

2. Scenario 1 can only be forced on the loser right away if he/she's left with 11 balls in the smaller one and 12 in the bigger one.

3. 2's condition can be forced on the loser right away only if (s)he leaves 2, 3, 4 or 6 (factors of 12 save 1 and itself) balls in the small pile, leading to a 12-ball pile.

4. The loser can be forced to leave a 3-ball pile if left with a 10-ball one, which can be done in the very first move by A.

Answered by Nautilus on May 8, 2021