OFFSET
0,4
COMMENTS
a(n) = dB(n+1,t)/dt|_{t=1}, where B(n,t) are the Stern polynomials, defined by B(0,t)=0, B(1,t)=1, B(2n,t)=tB(n,t), B(2n+1,t)=B(n+1,t)+B(n,t) for n>=1 (see S. Klavzar et al. and A125184).
LINKS
N. Calkin and H. S. Wilf, Recounting the rationals, Amer. Math. Monthly, 107 (No. 4, 2000), pp. 360-363.
S. Klavzar, U. Milutinovic, and C. Petr, Stern polynomials, Adv. Appl. Math. 39 (2007) 86-95.
FORMULA
a(0)=0, a(1)=0, a(2)=1, a(2n+1)=a(n)+a(n+1), a(4n)=2a(2n)-a(n), a(4n+2)=a(2n+2)+a(2n) for n>=1.
EXAMPLE
a(8)=4 because the hyperbinary representations of 8 are 200 (=2*2^2+0*2^1+0*2^0), 120 (=1*2^2+2*2^1+0*2^0), 1000 (=1*2^3+0*2^2+0*2^1+0*2^0) and 112 (=1*2^2+1*2^1+2*1^0), having a total of 0+1+1+2=4 digits 1 (see S. Klavzar et al. Table 1).
MAPLE
a[0]:=0: a[1]:=0: a[2]:=1: for n from 1 to 50 do a[2*n+1]:=a[n]+a[n+1]: a[4*n]:=2*a[2*n]-a[n]: a[4*n+2]:=a[2*n+2]+a[2*n] od: seq(a[n+1], n=0..100);
B:=proc(n) if n=0 then 0 elif n=1 then 1 elif n mod 2 = 0 then t*B(n/2) else B((n+1)/2)+B((n-1)/2) fi end: seq(subs(t=1, diff(B(n+1), t)), n=0..100);
MATHEMATICA
B[0, _] = 0; B[1, _] = 1; B[n_, t_] := B[n, t] = If[EvenQ[n], t*B[n/2, t], B[1 + (n-1)/2, t] + B[(n-1)/2, t]]; a[n_] := D[B[n+1, t], t] /. t -> 1; Table[a[n], {n, 0, 78}] (* Jean-François Alcover, Sep 07 2024, after 2nd Maple program *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Emeric Deutsch, Dec 05 2006
STATUS
approved