Browse · MathNet
PrintEstonian Mathematical Olympiad
Estonia counting and probability
Problem
There are candies on the table. On every turn, a player eats a number of candies that is greater than and divides the number of candies on the table at the start of the turn, but must leave at least candy on the table. Two players take alternate turns and the player who is unable to make a move loses. Find all positive integers for which the first player can always win.
Solution
Define all even numbers which are not odd powers of as good and the rest of the positive integers as bad. We show that the player before whose turn the number of candies is good has a move which yields in a bad number of candies, whereas the player before whose turn the number of candies is bad either has lost or is forced to leave a good number of candies on the table. As the number of candies is reduced in each move, the starting player wins if, initially the number of candies on the table is good.
A player before whose turn the number of candies is even but not a power of can eat the number of candies equal to its odd factor different from . After that, the number of candies on the table is odd, i.e. bad. If before the turn the number of candies is equal to an even power of , one can eat exactly half of the candies, leaving an odd power of candies on the table, i.e. a bad number.
On the other hand, if the number of candies before the turn is odd, the player can only choose odd factors. This yields in an even number of candies left on the table. Furthermore, the number of candies left on the table is divisible by the number of candies taken from the table which is odd, hence, the number of candies cannot be a power of . Therefore, the number of candies left on the table is good. However, if the number of candies before the turn is equal to an odd power of , the player can only choose even factors, which results in an even number of candies left on the table. Furthermore, the rules do not allow eating more than half of the candies. Therefore, the number of candies left of the table can only be a power of if its exponent is less by than before the move. This would be an even power of which is also a good number.
A player before whose turn the number of candies is even but not a power of can eat the number of candies equal to its odd factor different from . After that, the number of candies on the table is odd, i.e. bad. If before the turn the number of candies is equal to an even power of , one can eat exactly half of the candies, leaving an odd power of candies on the table, i.e. a bad number.
On the other hand, if the number of candies before the turn is odd, the player can only choose odd factors. This yields in an even number of candies left on the table. Furthermore, the number of candies left on the table is divisible by the number of candies taken from the table which is odd, hence, the number of candies cannot be a power of . Therefore, the number of candies left on the table is good. However, if the number of candies before the turn is equal to an odd power of , the player can only choose even factors, which results in an even number of candies left on the table. Furthermore, the rules do not allow eating more than half of the candies. Therefore, the number of candies left of the table can only be a power of if its exponent is less by than before the move. This would be an even power of which is also a good number.
Final answer
All even n that are not of the form 2^(2k+1).
Techniques
Games / greedy algorithmsInvariants / monovariants