login

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”).

A151843
a(0)=0; a(1)=0; a(2)=0; for n>=3 if n=2^i + j with 0<=j<2^i then a(n)=a(j) + a(j + 1) except we add 1 if j=2^i-1.
32
0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 1, 1, 0, 1, 3, 3, 0, 0, 1, 1, 0, 1, 3, 2, 0, 1, 2, 1, 1, 4, 6, 4, 0, 0, 1, 1, 0, 1, 3, 2, 0, 1, 2, 1, 1, 4, 6, 3, 0, 1, 2, 1, 1, 4, 5, 2, 1, 3, 3, 2, 5, 10, 10, 5, 0, 0, 1, 1, 0, 1, 3, 2, 0, 1, 2, 1, 1, 4, 6, 3, 0, 1, 2, 1, 1, 4, 5, 2, 1, 3, 3, 2, 5, 10, 10, 4, 0, 1, 2, 1, 1, 4, 5
OFFSET
0,8
LINKS
FORMULA
I would very much like a g.f. for this sequence!
EXAMPLE
From Omar E. Pol, Jul 17 2009: (Start)
Triangle begins:
0;
0;
0,1;
0,0,1,2;
0,0,1,1,0,1,3,3;
0,0,1,1,0,1,3,2,0,1,2,1,1,4,6,4;
... (End)
MAPLE
M:=520;
f:=proc(r, s, a, b) local s1, n, i, j; global M;
s1:=array(0..M+10);
s1[0]:=r; s1[1]:=s;
for n from 2 to M do i:=floor(log(n)/log(2));
j:=n-2^i;
if (j=2^i-1) then s1[n]:=a*s1[j]+b*s1[j+1]+1 else
s1[n]:=a*s1[j]+b*s1[j+1]; fi;
od:
[seq(s1[n], n=0..M)];
end;
f(0, 0, 1, 1);
MATHEMATICA
M = 520; f[r_, s_, a_, b_] := Module[{s1, n, i, j} , s1[0] = r; s1[1] = s; For[n = 2, n <= M, n++, i = Floor[Log[2, n]]; j = n - 2^i; If[j == 2^i - 1, s1[n] = a*s1[j]+b*s1[j+1]+1, s1[n] = a*s1[j]+b*s1[j+1]]]; Table[s1[n], {n, 0, M}]]; f[0, 0, 1, 1] (* Jean-François Alcover, Mar 03 2014, after Maple *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
N. J. A. Sloane, Jul 17 2009, Jul 19 2009
STATUS
approved