OFFSET
1,1
COMMENTS
Such a sequence has finite length when the k-th term becomes greater than k.
The term a(2) = 0 is only conjectural - see A005185. a(4) = 0 is a theorem of Balamohan et al. (2007). - N. J. A. Sloane, Nov 07 2007, Apr 18 2014.
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
B. Balamohan, A. Kuznetsov and S. Tanny, On the behavior of a variant of Hofstadter's Q-sequence, J. Integer Sequences, Vol. 10 (2007), #07.7.1.
D. R. Hofstadter, Curious patterns and non-patterns in a family of meta-Fibonacci recursions, Lecture in Doron Zeilberger's Experimental Mathematics Seminar, Rutgers University, April 10 2014; Part 1, Part 2.
D. R. Hofstadter, Graph of first 21500 terms.
EXAMPLE
a(1) = 6: the f-sequence is defined by f(1) = 1, f(n) = 2f(n-f(n-1)), which gives 1,2,2,4,2,8 but f(7) = 2f(-1) is undefined, so the length is 6.
MATHEMATICA
Table[Clear[a]; a[n_] := a[n] = If[n<=k, 1, a[n-a[n-1]]+a[n-a[n-k]]]; t={1}; n=2; While[n<10000 && a[n-1]<n, AppendTo[t, a[n]]; n++ ]; len=Length[t]; If[len==9999, 0, len], {k, 100}]
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Nov 06 2007
STATUS
approved