login
A373709
Partial sums of A119387.
3
0, 0, 1, 1, 3, 4, 6, 6, 9, 11, 14, 15, 18, 20, 23, 23, 27, 30, 34, 36, 40, 43, 47, 48, 52, 55, 59, 61, 65, 68, 72, 72, 77, 81, 86, 89, 94, 98, 103, 105, 110, 114, 119, 122, 127, 131, 136, 137, 142, 146, 151, 154, 159, 163, 168, 170, 175, 179, 184, 187, 192
OFFSET
0,5
FORMULA
a(n) = Sum_{m = 0..n} A119387(m).
a(n) = (n+2)*d - 2*n - 2^d + p - 1, with d = bit_width(n+1) = A070939(n+1) and p = popcount(n+1) = A000120(n+1).
a(n) = A001855(n+2) - A005187(n+1).
MAPLE
a:= proc(n) option remember; `if`(n<0, 0,
a(n-1)+ilog2(n+1)-padic[ordp](n+1, 2))
end:
seq(a(n), n=0..60); # Alois P. Heinz, Jun 23 2024
MATHEMATICA
Accumulate[Table[BitLength[k] - 1 - IntegerExponent[k, 2], {k, 100}]] (* Paolo Xausa, Oct 01 2024 *)
PROG
(PARI)
bit_width(n)=logint(n, 2)+1;
a(n)=my(d=bit_width(n+1), p=hammingweight(n+1)); (n+2)*d-2*n-2^d+p-1;
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Antoine Mathys, Jun 14 2024
STATUS
approved