login
a(n) = a(a(a(a(n-1)))) + a(n - a(n-1)) with a(1)=a(2)=1.
6

%I #29 Aug 06 2017 12:21:03

%S 1,1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,

%T 8,8,8,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,

%U 11,11,11,11,11,11,12,13,13,13,13,13,13,13,13,13,13,13,13,14,14,15

%N a(n) = a(a(a(a(n-1)))) + a(n - a(n-1)) with a(1)=a(2)=1.

%H Joerg Arndt, <a href="/A087836/b087836.txt">Table of n, a(n) for n = 1..10000</a>

%p a:= proc(n) option remember; `if`(n<3, 1,

%p a(a(a(a(n-1)))) +a(n-a(n-1)))

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Aug 06 2017

%t a[n_Integer?Positive] := a[n] =a[a[a[a[n-1]]]] + a[n - a[n-1]]; a[1] = a[2] = 1; Table[a[n], {n, 1, 256}]

%o (PARI) lista(nn) = {va = vector(nn); va[1] = 1; va[2] = 1; for (n=3, nn, va[n] = va[va[va[va[n-1]]]]+va[n-va[n-1]];); va;} \\ _Michel Marcus_, Aug 06 2017

%Y Cf. A004001. Different from A087817.

%K nonn

%O 1,3

%A _Roger L. Bagula_, Oct 07 2003

%E Corrected by _Michel Marcus_, Aug 06 2017