%I #41 Apr 10 2024 09:37:35
%S 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,
%T 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,
%U 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
%N Nim function for Take-a-Prime (or Subtract-a-Prime) Game.
%C The zero positions are given by A025043. - _Nathan Fox_, May 21 2013
%C Concerning the January 1997 dissertation of Achim Flammenkamp, his home page (currently http://wwwhomes.uni-bielefeld.de/cgi-bin/cgiwrap/achim/index.cgi) has the link shown below, and a comment that a book was published in July 1997 by Hans-Jacobs-Verlag, Lage, Germany with the title Lange Perioden in Subtraktions-Spielen (ISBN 3-932136-10-1). This is an enlarged study (more than 200 pages) of his dissertation. - _N. J. A. Sloane_, Jul 25 2019
%C As noted by Alexis Huet, a(n) <= 11 for all n <= 32452842 (see links). - _Pontus von Brömssen_, Jul 09 2022
%C From _Bert Dobbelaere_, Apr 09 2024: (Start)
%C For n <= 10^9, a(n) <= 11.
%C For even n <= 10^9, if a(n)=0, n is in {0, 10, 34, 100, 310}.
%C For even n <= 10^9, if a(n)=1, n is in {2, 12, 36, 102, 312}.
%C For even n <= 10^9, if a(n)=2, n is in {4, 14, 38, 104, 314, 1574}.
%C For even n <= 10^9, if a(n)=3, n is in {6, 16, 40, 106, 316, 1576, 1996, 5566}.
%C The only odd n <= 10^9 for which a(n)=4 is 17.
%C The only odd n <= 10^9 for which a(n)=5 is 19.
%C The only odd n <= 10^9 for which a(n)=6 is 21.
%C The only even n <= 10^9 for which a(n)=7 is 24.
%C There are no even n <= 10^9 for which a(n)=8 or a(n)=10.
%C There are no odd n <= 10^9 for which a(n)=11. (End)
%D R. K. Guy, Unsolved Problems in Number Theory, E26.
%H Eric M. Schmidt, <a href="/A014589/b014589.txt">Table of n, a(n) for n = 0..10000</a>
%H Achim Flammenkamp, <a href="http://wwwhomes.uni-bielefeld.de/~achim/diss.ps.gz">Lange Perioden in Subtraktions-Spielen</a>, Dissertation, Dept. Math., University of Bielefeld, Germany.
%H Alexis Huet, <a href="https://github.com/ahstat/nim-take-a-prime/blob/master/outputs/primes/nims/primes_32452843.csv">First 32452843 terms</a>.
%H Alexis Huet, <a href="https://ahstat.github.io/Nim-take-a-prime/">Nim function for take-a-prime game</a>.
%o (Sage)
%o def A014589_list(max) :
%o res = []
%o for i in range(max+1) :
%o moves = list({res[i-p] for p in prime_range(i+1)})
%o moves.sort()
%o k = len(moves)
%o mex = next((j for j in range(k) if moves[j] != j), k)
%o res.append(mex)
%o return res
%o print(A014589_list(50))
%o # _Eric M. Schmidt_, Jul 20 2013, corrected _Eric M. Schmidt_, Apr 24 2019
%Y Cf. A025043, A014586-A014588, A355557.
%K nonn
%O 0,5
%A _Achim Flammenkamp_