Maths Olympiad Prep

Library / Baltic Way Shortlist /10 of 92

Baltic Way Shortlist, 2023

Combinatorics Difficulty 7.7 National Olympiad, round 2 Prove it Baltic Way

Fifty marbles are lying in a heap. Alfred and Bodil take turns in removing a positive number of marbles, Alfred starts and at each step the number of marbles removed needs to be a prime or a square. The winner is the one who empties the heap. Who wins if both play in an optimal way?

Solution

We make a table inductively that shows whether the player, whose turn it is if there are nn marbles left, wins (marked with a W) or loses (marked with an L).

nn1<br>W<br>-12<br>W<br>-23<br>W<br>-34<br>W<br>-45<br>W<br>-56<br>L7<br>W<br>-18<br>W<br>-29<br>W<br>-310<br>W<br>-4
nn11<br>W<br>-512<br>L13<br>W<br>-114<br>W<br>-215<br>W<br>-316<br>W<br>-417<br>W<br>-518<br>L19<br>W<br>-120<br>W<br>-2
nn21<br>W<br>-322<br>W<br>-423<br>W<br>-524<br>L25<br>W<br>-126<br>W<br>-227<br>W<br>-328<br>W<br>-429<br>W<br>-530<br>L
nn31<br>W<br>-132<br>W<br>-233<br>W<br>-334<br>W<br>-435<br>W<br>-536<br>W<br>-3637<br>W<br>-738<br>L39<br>W<br>-140<br>W<br>-2
nn41<br>W<br>-342<br>W<br>-443<br>W<br>-544<br>L45<br>W<br>-146<br>W<br>-247<br>W<br>-348<br>W<br>-449<br>W<br>-550<br>L

The proof of the correctness of the table is inductive. If there are at most 35 marbles left, a player cannot remove a number of marbles of the type 6k6k with k∈Zk \in \mathbb{Z}, because the numbers 6, 12, 18, 24 and 30 are neither prime numbers nor squares. We can conclude inductively that, as long as n≤35n \le 35, the number nn should be marked with an L if it is divisible by 6 (since a legal move will yield a number that is not divisible by 6), and it should be marked with a W if it is not divisible by 6 (since removing 1, 2, 3, 4 or 5 marbles yields to a number that is divisible by 6).

This argument is not valid for n=36n = 36, as one can remove all 36 marbles in one step and thus win.

The number n=37n = 37 is also winning, since one can remove 7 marbles to bring the opponent into a losing position with 30 marbles.

With n=38n = 38 marbles left it is not possible to win, since one would need to remove 38−30=838 - 30 = 8, 38−24=1438 - 24 = 14, 38−18=2038 - 18 = 20, 38−12=2638 - 12 = 26, 38−6=3238 - 6 = 32 or all 38 marbles to bring the opponent into a losing position, but the numbers 8, 14, 20, 26, 32 and 38 are neither prime numbers nor squares.

The next five numbers, 39, ..., 43 are winning positions, because a removal of 1, ..., 5 marbles leaves the opponent in the losing position with 38 marbles.

However, n=44n = 44 is again a losing position, because one would need to remove 44−38=644 - 38 = 6, 44−30=1444 - 30 = 14, 44−24=2044 - 24 = 20, 44−18=2644 - 18 = 26, 44−12=3244 - 12 = 32, 44−6=3844 - 6 = 38 or all 44 marbles to force the opponent into a losing position, but these moves are not allowed.

The next five numbers, 45, ..., 49 are winning positions, because a removal of 1, ..., 5 marbles leaves the opponent in the losing position with 44 marbles.

Now the number 50 is left and it is again a losing position, because Alfred would need to remove 50−44=650 - 44 = 6, 50−38=1250 - 38 = 12, 50−30=2050 - 30 = 20, 50−24=2650 - 24 = 26, 50−18=3250 - 18 = 32, 50−12=3850 - 12 = 38, 50−6=4450 - 6 = 44 or all 50 marbles to bring Bodil into a losing position, but these moves are not allowed. Hence Bodil will win the game if she plays in an optimal way.

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.