OFFSET
0,4
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
FORMULA
Let b(n) = A002487(n), Stern's diatomic series.
a(n+1)*b(n) - a(n)*b(n+1) = 1 for n >= 0.
a(2n+1) = a(n) + a(n+1) + b(n) + b(n+1) for n >= 0.
a(2n) = a(n) + b(n) for n >= 0.
a(2^n + k) = -n*a(k) + (n^2 + n + 1)*b(k) for 0 <= k <= 2^n.
b(2^n + k) = -a(k) + (n + 1)*b(k) for 0 <= k <= 2^n.
a(2^m + k) = b(2^m+k)*m + b(k), m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Mar 09 2018
a(2^(m+1)+2^m+1) = 2*m+1, m >= 0. - Yosu Yurramendi, Mar 09 2018
From Yosu Yurramendi, May 08 2018: (Start)
a(2^m) = m, m >= 0.
a(2^r*(2*k+1)) = a(2^r*(2*k)) + a(2^r*(2*k+2)), r = m - floor(log_2(k)) - 1, m > 0, 1 <= k < 2^m.
(End)
MAPLE
A156140 := proc(n)
option remember ;
if n <= 1 then
n-1 ;
else
(2*A007814(n-1)+1)*procname(n-1)-procname(n-2) ;
end if;
end proc:
seq(A156140(n), n=0..80) ; # R. J. Mathar, Mar 14 2009
MATHEMATICA
Fold[Append[#1, (2 IntegerExponent[#2, 2] + 1) #1[[-1]] - #1[[-2]] ] &, {-1, 0}, Range[73]] (* Michael De Vlieger, Mar 09 2018 *)
PROG
(PARI) first(n)=my(v=vector(n+1)); v[1]=-1; v[2]=0; for(k=1, n-1, v[k+2]=(2*valuation(k, 2)+1)*v[k+1] - v[k]); v \\ Charles R Greathouse IV, Apr 05 2016
(PARI) fusc(n)=my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); b
a(n)=my(m=1, s, t); if(n==0, return(-1)); while(n%2==0, s+=fusc(n>>=1)); while(n>1, t=logint(n, 2); n-=2^t; s+=m*fusc(n)*(t^2+t+1); m*=-t); m*(n-1) + s \\ Charles R Greathouse IV, Dec 13 2016
(R)
a <- c(0, 1)
maxlevel <- 6 # by choice
for(m in 1:maxlevel) {
a[2^(m+1)] <- m + 1
for(k in 1:(2^m-1)) {
r <- m - floor(log2(k)) - 1
a[2^r*(2*k+1)] <- a[2^r*(2*k)] + a[2^r*(2*k+2)]
}}
a
# Yosu Yurramendi, May 08 2018
CROSSREFS
From Yosu Yurramendi, Mar 09 2018: (Start)
a(2^m + 0) = A000027(m), m >= 0.
a(2^m + 1) = A002061(m+2), m >= 1.
a(2^m + 2) = A002522(m), m >= 2.
a(2^m + 3) = A033816(m-1), m >= 2.
a(2^m + 4) = A002061(m), m >= 2.
a(2^m + 5) = A141631(m), m >= 3.
a(2^m + 6) = A084849(m-1), m >= 3.
a(2^m + 7) = A056108(m-1), m >= 3.
a(2^m + 8) = A000290(m-1), m >= 3.
a(2^m + 9) = A185950(m-1), m >= 4.
a(2^m + 10) = A144390(m-1), m >= 4.
a(2^m + 12) = A014106(m-2), m >= 4.
a(2^m + 16) = A028387(m-3), m >= 4.
a(2^m + 18) = A250657(m-4), m >= 5.
a(2^m + 20) = A140677(m-3), m >= 5.
a(2^m + 32) = A028872(m-2), m >= 5.
a(2^m - 1) = A005563(m-1), m >= 0.
a(2^m - 2) = A028387(m-2), m >= 2.
a(2^m - 3) = A033537(m-2), m >= 2.
a(2^m - 4) = A008865(m-1), m >= 3.
a(2^m - 7) = A140678(m-3), m >= 3.
a(2^m - 8) = A014209(m-3), m >= 4.
a(2^m - 16) = A028875(m-2), m >= 5.
a(2^m - 32) = A108195(m-5), m >= 6.
(End)
KEYWORD
AUTHOR
Arie Werksma (Werksma(AT)Tiscali.nl), Feb 04 2009
STATUS
approved