Maths WorkshopMaths problems with full solutions
Exercise 635Combinatorics › Counting principlesM1Added 5 Nov 2026

A subtraction game with moves 1, 3 and 4

#combinatorial games#losing positions#induction#periodicity

Statement

There are nn stones. Two players alternately remove 11, 33 or 44 stones; the player who cannot move loses. Determine for which nn the first player has a winning strategy. Who wins with 100100 stones?

Hint

Compute the first few losing positions: 00 is losing. Guess a period and prove it by induction.

Show solutionHide solution

Solution

Idea. A position is losing iff all its moves lead to winning positions. Compute the losing positions and find the pattern.

Claim. The losing positions are exactly the nn with n≡0n\equiv0 or 2(mod7)2\pmod7.

Proof by strong induction on nn.
- *From a position in LL every move leads outside LL:* if n≡0n\equiv0, the moves lead to n−1≡6n-1\equiv6, n−3≡4n-3\equiv4, n−4≡3n-4\equiv3; if n≡2n\equiv2, they lead to n−1≡1n-1\equiv1, n−3≡6n-3\equiv6, n−4≡5n-4\equiv5. None of these is 00 or 22 mod 77.
- *From a position outside LL there is a move into LL:* n≡1n\equiv1: remove 11; n≡3n\equiv3: remove 11; n≡4n\equiv4: remove 44; n≡5n\equiv5: remove 33; n≡6n\equiv6: remove 44.

Together with n=0n=0 losing, positions in LL are exactly the losing ones.

Answer. The first player wins iff n≢0,2(mod7)n\not\equiv0,2\pmod7. For n=100≡2(mod7)n=100\equiv2\pmod7 the first player loses.

Lesson. Compute small cases, guess the periodic set of losing positions, then verify the two properties.