login
a(0)=3, a(1)=1, a(2)=0; thereafter a(n) = a(n-1-a(n-1))+a(n-2-a(n-2)) unless a(n-1) <= n-1 or a(n-2) <= n-2 in which case the sequence terminates.
2

%I #8 Jul 07 2014 02:32:16

%S 3,1,0,3,3,4,2,4,6,3,2,8,9,6,7,8,8,10,10,10,9,11,10,11,18,11,9,17,12,

%T 10,18,19,18,16,17,20,18,18,20,20,20,19,19,21,21,21,29,28,20,22,29,28,

%U 22,29,36,28,27,27,28,36,29,30,38,37,27,27,38,32,32,38,37,35,34,38,40,37,37,40,38,38,39

%N a(0)=3, a(1)=1, a(2)=0; thereafter a(n) = a(n-1-a(n-1))+a(n-2-a(n-2)) unless a(n-1) <= n-1 or a(n-2) <= n-2 in which case the sequence terminates.

%D Higham, Jeff and Tanny, Stephen, A tamely chaotic meta-Fibonacci sequence. Twenty-third Manitoba Conference on Numerical Mathematics and Computing (Winnipeg, MB, 1993). Congr. Numer. 99 (1994), 67-94.

%H Reinhard Zumkeller, <a href="/A244483/b244483.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>

%p f := proc(n) option remember;

%p if n=0 then 3

%p elif n=1 then 1

%p elif n=2 then 0

%p else

%p f(n-1-f(n-1))+f(n-2-f(n-2));

%p fi;

%p end proc;

%p [seq(f(n),n=0..80)];

%o (Haskell)

%o a244483 n = a244483_list !! n

%o a244483_list = 3 : 1 : 0 : zipWith (+) xs (tail xs)

%o where xs = map a244483 $ zipWith (-) [1..] $ tail a244483_list

%o -- _Reinhard Zumkeller_, Jul 07 2014

%Y See A006949 for overview of sequences produced by this recurrence and various initial conditions.

%K nonn

%O 0,1

%A _N. J. A. Sloane_, Jul 03 2014