Euclid is a two-player impartial game invented by A.J. Cole and A.J.T. Davie in 1969.

A position in Euclid is a pair (x, y) of positive integers. A legal move consists of subtracting from the larger integer any positive multiple of the smaller one, as long as the result is still positive. The game ends when no more moves are possible, namely, at position (d, d), where d = gcd(x, y). The last player to move wins.

The Sprague-Grundy function of Euclid is given by the formula g(x, y) = floor(abs(y/x - x/y)):

16 15753221110000000
15 14743221110000000
14 13643211100000000
13 12642211100000000
12 11532111000000000
11 10532110000000000
10 9432110000000000
8421100000000011
7321000000001111
6311000000011111
5210000001111122
4210000011112222
3100001112222333
2000111223334445
1001223344556677
0123456789101112131415
12345678910111213141516


< - Combinatorial games (anti spam-bot feature)
< - Home page © 2004-2005, Gabriel Nivasch