%I #32 Jul 09 2022 18:28:49
%S 0,1,2,0,1,2,3,0,1,2,0,1,2,3,0,1,2,0,1,2,3,0,1,2,3,0,1,2,0,1,2,3,0,1,
%T 2,0,1,2,3,0,1,2,0,1,2,3,0,1,2,3,0,1,2,0,1,2,3,0,1,2,0,1,2,3,0,1,2,0,
%U 1,2,3,0,1,2,3,0,1,2,0,1,2,3,0,1,2,0,1,2,3,0,1,2,0,1,2,3,0,1,2
%N Nim function for Take-a-Factorial-Game (a subtraction game).
%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
%D R. K. Guy, Unsolved Problems in Number Theory, E26.
%H Eric M. Schmidt, <a href="/A014587/b014587.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.
%F Conjecture: Appears to be periodic with period of length 25 = [0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3] starting with the initial term (there is no preamble). - _Michel Dekking_, Jul 26 2019
%F This conjecture is false, because moving from 10! = 3628800 to 0 is a legal move, and so a(3628800) cannot be zero. A similar argument shows that for no value of P is this sequence periodic with period P starting at term 0 (for a(P!) cannot be zero). - _Nathan Fox_, Jul 28 2019.
%F The first counterexample to the conjecture above is a(5050) = 4. - _Pontus von Brömssen_, Jul 09 2022
%o (Sage)
%o def A014587(max) :
%o res = []
%o fact = [1]
%o while fact[-1] <= max : fact.append(factorial(len(fact)))
%o for i in range(max+1) :
%o moves = list({res[i-f] for f in fact if f <= i})
%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 # _Eric M. Schmidt_, Jul 20 2013, corrected _Eric M. Schmidt_, Apr 24 2019
%Y Cf. A014586-A014589, A355556.
%K nonn
%O 0,3
%A _Achim Flammenkamp_