Maths Olympiad Prep

Track / Stage 7 / 162 of 300 #1562 of 1964

Problem 1562

National olympiad second round; IMO P1/P4
Combinatorics Difficulty 7.3 Find the answer

Two players, AA and B,B, alternatively take stones from a pile of n2n \geq 2 stones. AA plays first and in his first move he must take at least one stone and at most n1n-1 stones. Then each player must take at least one stone and at most as many stones as his opponent took in the previous move. The player who takes the last stone wins. Which player has a winning strategy?

A number or a short expression. Spacing and $ signs are ignored.

Official solution

1. Initial Setup and Definitions:
- Let n n be the number of stones in the pile.
- Player A A starts and must take between 1 and n1 n-1 stones.
- Each subsequent player must take at least one stone and at most as many stones as the opponent took in the previous move.
- The player who takes the last stone wins.

2. Winning Strategy Analysis:
- We need to determine which player has a winning strategy based on the value of n n .

3. **Case 1: n n is a power of 2**:
- Suppose n=2k n = 2^k for some integer k k .
- Player A A must take between 1 and 2k1 2^k - 1 stones.
- No matter how many stones A A takes, the remaining number of stones will not be a power of 2.
- Player B B can always respond by taking a number of stones such that the remaining number of stones is a power of 2.
- This ensures that Player B B can always force the game back to a power of 2 situation after each of A A 's moves.
- Therefore, Player B B has a winning strategy when n n is a power of 2.

4. **Case 2: n n is not a power of 2**:
- Suppose n n is not a power of 2.
- Player A A can take a number of stones such that the remaining number of stones is a power of 2.
- For example, if n=13 n = 13 , Player A A can take 5 stones, leaving 8 stones (which is 23 2^3 ).
- This forces Player B B into the situation described in Case 1, where n n is a power of 2.
- Player A A can always make the first move to reduce the pile to a power of 2, ensuring that Player B B is always the one to face the power of 2 situation.
- Therefore, Player A A has a winning strategy when n n is not a power of 2.

5. General Strategy:
- A position is a winning position if and only if the highest number of stones your opponent last took (the number you may take this turn) is at least as many as the highest power of 2 dividing your number.
- The winning strategy is to remove enough stones to leave a number of stones divisible by 2 2 more times than any number between it and the number you started with.
- For example, if your opponent had 13 stones and removed 6 to give 7, a winning move is to take away either 1 or 3 to get to 6 or 4.

6. Proof of Strategy:
- Suppose you are at m=2k m = 2^k \ell and you are allowed to take j2k j \geq 2^k .
- Then you take 2k 2^k stones to leave you at mj=2k(1) m - j = 2^k (\ell - 1) , which has a higher power of 2 than m m does.
- On the other hand, if you are at m=2k m = 2^k \ell and you are only allowed to take j<2k j < 2^k , then you cannot raise the power of 2 by taking away stones.
- The positions you can win from are if you have n n stones left and you are allowed to take n n or more; this is certainly a winning position since no power of 2 dividing n n can be bigger than n n itself.

\blacksquare

The final answer is: If n \boxed{ n } is a power of 2, then Player B B wins. Otherwise, Player A A wins.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.