Exercise · Volume 1 · 1.2.8-37
Exercise 1.2.8-37
not stated yet in Lean solution written
| Rating | M35 |
|---|---|
| Markers | M (mathematical) |
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 1.2.8 of Volume 1. Companion chapter: Fibonacci numbers |
The task
Find the best first move in the chip game with 1000 chips, where each move takes at most twice what the opponent took and the first move may not take all chips.
The exact wording is in your copy of the book.
Hints
Open one hint at a time. Try the exercise again after each.
Hint 1
Look for the winning condition in the Fibonacci number system of Exercise 1.2.8-34. Let be the smallest term of the representation of .
Hint 2
Claim: the player to move with chips and the limit wins if and only if . Prove it by induction on .
Hint 3
The winning move is to take chips. For the other direction, bound for .
Solution
Show the solution
Plan. Define the game state : chips are left and the mover may take chips with . The mover who takes the last chip wins. The first player has the state . For let be the smallest term in the Fibonacci representation of Exercise 1.2.8-34, with .
Claim. In the state with the mover has a winning strategy if and only if .
Two facts about are needed. Write for the index of .
Fact 1. If , then . Indeed with , and because for .
Fact 2. If , then . Proof. Let , so . The representation of is that of (terms of index at least ) followed by that of (terms of index at most ). The gap between the two parts is at least , so the combined list is admissible, and it is the representation of by uniqueness. Hence . Let . All terms of have index in , and they have gaps at least . A set of such indices has the sum at most . (Induction on the number of terms: if is the largest index, the sum is at most , using the bound for indices in , or the empty set when .) So , which gives . Since , it follows that .
Proof of the claim, by induction on .
Winning side. Let . If , the mover takes all chips and wins. Otherwise the mover takes . If , the mover has won. Otherwise the opponent has the state , and by Fact 1. By the induction hypothesis the opponent loses.
Losing side. Let . A move takes chips, and because . The opponent gets and by Fact 2. By the induction hypothesis the opponent wins. So every move loses.
The answer. , so and the first player wins. The move is to take chips, which leaves for the opponent with the limit , and .
A python search over every first move shows that is the only winning first move. The first player wins from every pile that is not a Fibonacci number, and loses for a Fibonacci number , where .
Check
With python and a full search of the game tree for all piles and all limits: the mover wins in exactly when . For the only first move with is . Small cases: gives and the winning move is : the opponent has chips and limit , takes or , and then the first player takes the last or . For , a Fibonacci number, every first move loses.
Remarks
A full search for small piles shows which moves win in : the move must take a tail of the representation with , where either or the term just above the tail is more than . Fact 1 is the case . This is the game of Fibonacci Nim. Exercise 1.2.8-38 asks for a program that plays it.
This solution is checked, and a person has not reviewed it yet. The source.
In Lean
not stated yet The exercise is not stated in Lean yet.
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.