login
a(0) = 1, a(1) = 2; for n>0, a(2n) = |a(n)-a(n-1)|, a(2n+1) = a(n)+a(n-1).
3

%I #12 Apr 04 2024 09:46:17

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

%T 4,8,4,8,4,8,4,8,4,8,4,8,4,8,3,9,2,8,1,9,2,10,3,9,4,10,3,11,4,12,4,12,

%U 4,12,4,12,4,12,4,12,4,12,4,12,4,12,4,12,4,12,4,12,4,12,4,12,4,12,4,12,4

%N a(0) = 1, a(1) = 2; for n>0, a(2n) = |a(n)-a(n-1)|, a(2n+1) = a(n)+a(n-1).

%C For 2*2^k-2 <= n <= 3*2^k-1, a(n) alternates: 2^floor(k/2) if n is even, A029744(k+2) if n is odd. - _Robert Israel_, Nov 08 2016

%H Robert Israel, <a href="/A075825/b075825.txt">Table of n, a(n) for n = 0..10000</a>

%p A[0]:= 1: A[1]:= 2:

%p for n from 1 to 100 do

%p A[2*n]:= abs(A[n]-A[n-1]);

%p A[2*n+1]:= A[n]+A[n-1];

%p od:

%p seq(A[n],n=0..201); # _Robert Israel_, Nov 08 2016

%t a[0]=1; a[1]=2; a[n_]:=If[EvenQ[n],Abs[a[n/2]-a[n/2-1]],a[(n-1)/2]+a[(n-3)/2]]; Array[a,95,0] (* _Stefano Spezia_, Apr 04 2024 *)

%Y Cf. A029744.

%K nonn,look

%O 0,2

%A _John W. Layman_, Oct 14 2002