login
A116575
a(0) = 0; a(1) = a(2) = 1; for n > 2: a(n) = a(a(n-2)) + a(n-1 - abs(a(n-1) - a(n-2))) if a(n-2) < n, a(n) = 0 otherwise.
0
0, 1, 1, 2, 2, 3, 3, 5, 5, 8, 6, 10, 8, 12, 13, 20, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OFFSET
0,4
COMMENTS
"Limited chaotic sequence" based on A005229.
a(n) = 0 for n > 16.
MATHEMATICA
a[0] = 0; a[1] = a[2] = 1; a[n_] := a[n] = If[a[n - 2] < n, a[a[n - 2]] + a[n - 1 - Abs[a[n - 1] - a[n - 2]]], 0]; Array[a, 32, 0] (* JungHwan Min, Jan 14 2017 *)
PROG
(PARI) M(n)=v[n+1] {m=32; v=vector(m+1); v[1]=0; v[2]=1; v[3]=1; for(n=3, m, c=M(n-2); v[n+1]=if(c<n, M(c)+M(n-1-abs(M(n-1)-c)), 0)); for(j=0, m, print1(M(j), ", "))}
CROSSREFS
Cf. A005229.
Sequence in context: A346523 A184324 A274168 * A244800 A275972 A364349
KEYWORD
nonn,fini,full,less
AUTHOR
Roger L. Bagula, Mar 19 2006
EXTENSIONS
Edited by N. J. A. Sloane, Apr 10 2006 and Apr 16 2006
Definition corrected by JungHwan Min, Jan 14 2017
STATUS
approved