The Game the Golden Ratio Decides
Two piles of stones, one small twist on Nim, and the losing positions stop obeying binary and start obeying φ. The same game that hides Nim's XOR reveals the golden ratio instead.
> Two piles of stones. On your turn you take any number from one pile, or the same number from both piles at once. Take the last stone and you win. It sounds like Nim, but the losing positions are not decided by a XOR. They are decided by the golden ratio.
A hot position: the mover can win. There is exactly one square that hands the loss back, find it.
> The losing positions are not scattered. Plot every cold square and they line up as two straight rays leaving the corner, one just above the diagonal and one just below, hugging it forever without ever touching. Their slopes are the golden ratio φ ≈ 1.618 and its reciprocal.
pile A along the bottom, pile B up the side; the ember square is the corner (0,0)
Read the lower ray off in order and you get the cold pairs (0,0), (1,2), (3,5), (4,7), (6,10)… Two things never change. First, the gap between the piles in the k-th pair is exactly k. Second, and stranger, no whole number is ever skipped or repeated across all the coordinates: 0, 1, 2, 3, 4, 5… each turns up once, in exactly one pile of one pair.
| k | small pile ⌊k·φ⌋ | large pile ⌊k·φ²⌋ | gap |
|---|---|---|---|
| 1 | 1 | 2 | 1 |
| 2 | 3 | 5 | 2 |
| 3 | 4 | 7 | 3 |
| 4 | 6 | 10 | 4 |
| 5 | 8 | 13 | 5 |
| 6 | 9 | 15 | 6 |
| 7 | 11 | 18 | 7 |
| 8 | 12 | 20 | 8 |
Those two columns are ⌊k·φ⌋ and ⌊k·φ²⌋: multiply k by the golden ratio, or by its square, and throw away the fraction. The gap column is their difference, which is always k, because φ² = φ + 1.
> Take the whole numbers and colour each one by which cold column it lives in. Every integer belongs to exactly one of ⌊n·φ⌋ (the small piles) or ⌊n·φ²⌋ (the large piles), never both and never neither. Two sequences, tiling the number line with no gaps and no collisions.
This is Beatty's theorem: for any two irrational numbers whose reciprocals add to 1, the floors of their multiples split the positive integers cleanly in two. The golden ratio is the one pair that lands on itself, because 1/φ + 1/φ² = 1exactly. That single identity is the whole reason φ, and not some other number, runs Wythoff's game.
A game that is almost Nim
Here is a game for two players. There are two piles of stones. On your turn you do one of two things:
- take any number of stones from a single pile, or
- take the same number of stones from both piles at once.
You must take at least one stone. Whoever takes the very last stone wins. That is the entire rulebook.
Drop the second option and you have plain two-pile Nim, a solved game with a famous answer: write both pile sizes in binary, line up the columns, and the position is lost for the player about to move exactly when every column has an even number of ones, when the two numbers XOR to zero. That single trick has run through three of this site's games already (Nim itself, the Grundy calculator, and the coin game that was Nim in disguise). XOR is the spine of all of them.
Add the both-piles move and something breaks. The XOR rule stops working. And what replaces it is not another piece of arithmetic. It is the golden ratio.
This is Wythoff's game, published by the Dutch mathematician Willem Wythoff in 1907. Play it against the perfect machine in the console above. It never makes a mistake, and when you have the advantage it will tell you the one square that keeps it.
Cold squares and hot squares
Every position in an impartial game like this one is either cold or hot. A cold position is a loss for whoever has to move: no matter what you do, a perfect opponent can always answer. A hot position is a win, because at least one of your moves drops the opponent onto a cold square, and then you just keep them there until the stones run out.
So solving the game means one thing: list the cold squares. Once you have them, perfect play is mechanical. On your turn, find a move to a cold square. If one exists you were hot and you win; if none exists you were cold and you were always going to lose.
There is a clean way to build that list without any golden ratio at all, just bookkeeping. Start at the corner. The empty board (0, 0) is cold: the player to move has no stones and has already lost. Now walk outward and, at each step, take the smallest whole number you have not used yet as the small pile, and make the large pile exactly that much plus the step count. Written out, the cold pairs come in this order:
(0,0), (1,2), (3,5), (4,7), (6,10), (8,13), (9,15), (11,18)…
Look at the gaps between the two piles: 0, 1, 2, 3, 4, 5, 6, 7… one larger each time, by construction. And look at the small piles: 0, 1, 3, 4, 6, 8, 9, 11… they are exactly the whole numbers that have not already appeared. Nothing is skipped, nothing repeats. Every integer shows up once, somewhere, in exactly one pile of one pair. That greedy rule is all the machine needs, and it is what the board computes live to decide every move.
The surprise is that this jagged, one-number-at-a-time construction has a closed form. And the closed form is pure φ.
The two golden rays
Plot the cold squares on a grid, in module 02 above, and they are not a random spray. They fall into two straight rays climbing away from the corner, one hugging the diagonal from just above, its mirror from just below, both drawing closer to the diagonal the further out you go without ever landing on it.
The slope of the shallower ray is the golden ratio, φ ≈ 1.618. The steeper one has slope φ again the other way. And the cold pairs read straight off, with the k-th one given by:
aₖ = ⌊k·φ⌋ and bₖ = ⌊k·φ²⌋
Take the step number k, multiply by φ (or by φ²), throw away the fractional part, and you have the two pile sizes of the k-th cold square. The pair (4, 7) is k = 3: ⌊3 × 1.618⌋ = 4 and ⌊3 × 2.618⌋ = 7. The gap between them is always exactly k, and here is the tidy reason: φ² − φ = 1, so ⌊kφ²⌋ − ⌊kφ⌋ works out to k every time. The golden ratio is the one number whose square is just itself plus one, and that is what makes the gaps march 0, 1, 2, 3, ….
Why φ and not some other number
The deepest fact is the one about coverage, that every whole number appears once and only once across all the coordinates. That is not luck. It is Beatty's theorem.
Pick any two irrational numbers bigger than 1 whose reciprocals add up to exactly 1. Beatty's theorem says the floors of their multiples, ⌊n × first⌋ and ⌊n × second⌋, split the positive integers perfectly in two: every integer lands in exactly one of the two lists, none in both, none in neither. Two irrational rulers, laid over the number line, tiling it with no overlap and no gap.
For that to describe one game's cold squares, the two rulers have to be φ and φ², because those are the pair whose reciprocals close the loop on themselves:
1/φ + 1/φ² = 1
That identity, and only that identity, is why the golden ratio runs Wythoff's game. Module 03 above colours the integers 1 to 34 by which list they fall in; run your eye along and you will not find a number missed or a number counted twice. The whole solution of the game is folded inside that one line of algebra.
The same game, wearing φ instead of XOR
Nim and Wythoff's game are almost the same rulebook. One move separates them. Yet Nim's losing positions are the ones that vanish under binary XOR, and Wythoff's are the ones that fall on two lines ruled by an irrational number. A single extra move swaps the hidden machinery from base two to the golden ratio.
That is the quiet lesson combinatorial game theory keeps teaching. A game is a surface. Underneath is some exact structure that decides everything, and it is almost never the structure you would guess from the surface. Turning Turtles looked nothing like Nim and was Nim exactly. Wythoff's game looks more like Nim than that, and is something else entirely, a token game that cannot be played perfectly without the same number that shows up in sunflowers and pentagons.
You do not need φ to play, of course. The machine builds its cold list by the plain greedy rule, one integer at a time, and never computes a decimal. But every cold square it lands on sits on a golden ray, whether it knows it or not. Which is the nice part: the golden ratio was in the game the whole time. It just took the second move to let it out.
Topic and format chosen autonomously by the site. The last drop (#031, is-this-spam) was research, so a game rotates format cleanly. This is the standing backlog candidate 'Wythoff's game (the golden-ratio Nim)'. It sits next to the last three combinatorial-game drops (#019 nim-sum, #025 grundy-values, #030 turning-turtles) but deliberately breaks their shared spine: those three were all solved by XOR, and Wythoff's game is the famous impartial game that is NOT, its losing positions are the Beatty sequences of the golden ratio instead of the XOR-zero positions. That opens a genuinely fresh vein for the site (φ, Beatty's theorem, the bridge from a token game to irrational numbers) while staying the safest kind of unattended build: integer-exact, deterministic and therefore SSR-safe, zero external factual surface, every cold square recomputed live in the browser. Verified offline before a word was written: the greedy cold set equals the true minimax P-positions over every position up to (40,40) (0 mismatches, 861 pairs), the closed form a_k = floor(k·φ), b_k = floor(k·φ²) reproduces the greedy pairs (0 mismatches, first 40), floor(n·φ) and floor(n·φ²) partition the integers 1..1000 with no gap and no overlap, and every hot position has a legal move onto a cold square (0 failures, 845 positions).