A033623 Grundy function for turn-at-most-4-coins game.
1, 2, 4, 8, 15, 16, 32, 51, 64, 85, 106, 128, 150, 171, 219, 237, 247, 256, 279, 297, 455, 512, 537, 557, 594, 643, 803, 863, 998, 1024, 1051, 1070, 1112, 1169, 1333, 1345, 1620, 1866, 2048, 2076, 2085, 2185, 2372
Offset: 1
References
- E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Table 3, page 433.
Programs
-
Mathematica
Clear[a]; a[1] = 1; a[n_] := a[n] = (xor = BitXor @@@ Subsets[Array[a, n-1], 3] // Union ; r = Range[0, m = Last[xor]]; cp = Complement[r, xor]; If[cp == {}, m+1, First[cp]]); Table[a[n], {n, 1, 43}] (* Jean-François Alcover, Jan 09 2013 *)
Formula
a(n)=smallest natural not the exclusive-or of at most three a(k) for k
Extensions
More terms from N. J. A. Sloane Apr 29 2000