Euclid's game the Euclidean algorithm, played

Two positive numbers. On your turn, subtract any positive multiple of the smaller from the larger. The last player to move wins. Cole and Davie (1969): with a < b you are lost exactly when b/a < φ = 1.618…, and from b ≥ 2a you always win. Three rule sets differ only in where the game stops: Euclid lets you write a 0, Grossman's game stops at (d, d), M-Euclid stops once one number divides the other. All three have Sprague–Grundy values read off the continued fraction of b/a, so sums of several games are solved exactly too.

play against the solver

why — continued fractions and the XOR of Grundy values

Grundy values G(a, b)

Black cells are P-positions (G = 0); the dashed lines are b = φa and a = φb. Click a cell to play that pair.

where the three rule sets disagree — same positions, different stopping rules

paper check

observations