OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
Hsien-Kuei Hwang, Svante Janson and Tsung-Hsi Tsai, Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47. Also first authors' copy, 2016. See example 6.2.
FORMULA
a(n) = Sum_{k=1..n} Sum_{j=0..n} floor(k/2^j).
G.f.: (1/(1-x))*Sum_{k>=0} x^(2^k)/((1-x)*(1-x^(2^k))).
MAPLE
b:= proc(n) option remember; `if`(n=0, 0, b(iquo(n, 2))+n) end:
a:= proc(n) option remember; `if`(n=0, 0, b(n)+a(n-1)) end:
seq(a(n), n=0..50); # Alois P. Heinz, Jan 25 2022
MATHEMATICA
Accumulate[Table[2n-Count[IntegerDigits[2 n, 2], 1], {n, 0, 70}]] (* Harvey P. Dale, Oct 22 2011 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Aug 27 2006
STATUS
approved