OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..16383
FORMULA
EXAMPLE
For n = 11 = 1011_2 we have a(11) = 1^2 + 3^2 + 4^2 = 1 + 9 + 16 = 26.
MAPLE
a:= n-> (l-> add(l[-i]*i^2, i=1..nops(l)))(convert(n, base, 2)):
seq(a(n), n=0..80);
# second Maple program:
a:= proc(n) option remember; `if`(n=0, 0,
a(iquo(n, 2))+`if`(n::odd, ilog2(2*n)^2, 0))
end:
seq(a(n), n=0..80);
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Alois P. Heinz, Nov 20 2019
STATUS
approved