Skip to main content
OlympiadHQ

Browse · MathNet

Print

IRL_ABooklet

Ireland counting and probability

Problem

At the start of a game, a positive integer is fixed and you are given boxes for each , all are empty. You can adjust the number of marbles in the boxes by making a series of moves. The allowable moves are as follows: Move A: Add a marble to and to . Move B: Add a marble to and to . Move C_k: Take two marbles from for some and add a marble to . Moves can be repeated if you wish. You can do a move of the form for any desired values of , as long as Box contains at least two marbles. You win the game if you reach a stage where one box has a single marble and all other boxes are empty. Since the game depends on the number , we call it the -game. As an example, the following sequence of moves allows you to win the 3-game. We also give the number of marbles in the first few boxes after each listed move; later boxes are all empty. ``` A: 1 1 B: 2 1 1 C₁: 0 2 1 C₂: 0 0 2 C₃: 0 0 0 1 (winning position) ``` For which values of is it possible to win the -game? Explain carefully for each how you can win or why you can't win.
Solution
We denote by the number of marbles in Box after moves, and we define the associated sum by We have and each is non-negative. In fact, equals: It follows that for all , and that a necessary condition to win after steps is that is a power of 2. Suppose is even. Then, is a multiple of 3, so it follows inductively from (11) that is divisible by 3 for all . We deduce that is never a power of 2. Thus, we cannot win the -game if is even. Suppose instead that is odd. Then . If we first do Move and then repeatedly do Move , the numbers take on all values that are congruent to 2 (mod 3). We eventually reach a power of 2; in fact, using these moves, hits each odd power of 2 exceeding . Suppose that equals for some . All our subsequent moves will be -moves (meaning moves of the form ) and we continue until we can no longer perform a -move. Each -move lowers the total number of marbles by 1, so eventually no further -moves are possible. Note though that the sum stays unchanged according to (11), so it is still . Suppose that after steps, we can go no further. This implies that for all . Let be the largest value of such that , and suppose we are not in a winning position i.e. for at least one value of . Then This contradicts the assumption that is a power of 2. We conclude that the sequence of -moves can end only when we reach a winning position. We have shown that we can win if and only if is odd, and we have an algorithm for winning when it is possible.
Final answer
You can win the game if and only if M is odd.

Techniques

Invariants / monovariantsGames / greedy algorithms