Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #19 May 21 2021 16:24:11
%S 1,1,2,2,3,2,4,3,5,2,5,4,6,3,7,5,8,2,7,5,7,4,9,6,10,3,9,7,10,5,12,8,
%T 13,2,10,7,9,5,12,7,12,4,11,9,13,6,15,10,16,3,13,9,12,7,16,10,17,5,15,
%U 12,17,8,20,13,21,2,15,10,12,7,17,9,16,5,14,12
%N a(2n)=a(n-1)+a(n) and a(2n+1)=a(n+1) for n>=1, with a(0)=a(1)=1.
%C a(2^n) = A000045(n+2), a(2^n-1) = A000045(n+1). - _Alois P. Heinz_, Jul 06 2012
%H Alois P. Heinz, <a href="/A214126/b214126.txt">Table of n, a(n) for n = 0..8192</a>
%F a(0) = a(1) = 1, for n>=1: a(2*n) = a(n-1)+a(n) and a(2*n+1) = a(n+1).
%e a(2^n+1) = 2 because a(2) = 2 and a(2*n+1) = a(n+1).
%p a:= proc(n) local r;
%p a(n):= `if`(n<2, 1, `if`(irem(n, 2, 'r')=0, a(r-1)+a(r), a(r+1)))
%p end:
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Jul 06 2012
%t a[0] = a[1] = 1;
%t a[n_] := a[n] = If[EvenQ[n], a[n/2-1] + a[n/2], a[(n-1)/2+1]];
%t Array[a, 100, 0] (* _Jean-François Alcover_, May 31 2019 *)
%o (Python)
%o a = [1]*(77*2)
%o for n in range(1,77):
%o a[2*n ]=a[n-1]+a[n]
%o a[2*n+1]=a[n+1]
%o print(str(a[n-1]),end=',')
%Y Cf. A120562: same formula, seed {0,1}, first term removed.
%Y Cf. A082498: same formula, seed {1,0}, first term removed.
%Y Cf. A214127: same formula, seed {1,2}.
%Y Cf. A000045.
%K nonn,easy
%O 0,3
%A _Alex Ratushnyak_, Jul 04 2012