A014589 Nim function for Take-a-Prime (or Subtract-a-Prime) Game.
0, 0, 1, 1, 2, 2, 3, 3, 4, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 0, 4, 1, 5, 2, 6, 3, 4, 7, 0, 0, 1, 1, 2, 2, 3, 3, 4, 8, 5, 7, 6, 8, 9, 0, 4, 1, 5, 2, 6, 0, 4, 1, 5, 2, 6, 3, 4, 7, 5, 8, 4, 10, 5, 7, 6, 8, 4, 7, 5, 8, 6, 10, 9, 7, 4, 8, 5, 10, 6, 0, 4, 1, 5, 2, 6, 0, 4, 1, 5, 2, 6, 3
Offset: 0
Keywords
References
- R. K. Guy, Unsolved Problems in Number Theory, E26.
Links
- Eric M. Schmidt, Table of n, a(n) for n = 0..10000
- Achim Flammenkamp, Lange Perioden in Subtraktions-Spielen, Dissertation, Dept. Math., University of Bielefeld, Germany.
- Alexis Huet, First 32452843 terms.
- Alexis Huet, Nim function for take-a-prime game.
Programs
-
Sage
def A014589_list(max) : res = [] for i in range(max+1) : moves = list({res[i-p] for p in prime_range(i+1)}) moves.sort() k = len(moves) mex = next((j for j in range(k) if moves[j] != j), k) res.append(mex) return res print(A014589_list(50)) # Eric M. Schmidt, Jul 20 2013, corrected Eric M. Schmidt, Apr 24 2019
Comments