OFFSET
1,2
EXAMPLE
For a(3) = 186, the binary forms of n = 1, 2 and 3 are 1, 10 and 11. These together contain four 1's and one 0. The possible combinations to construct binary numbers of these are below with their equivalent decimal values:
1 1
10 2
11 3
101 5
110 6
111 7
1011 11
1101 13
1110 14
1111 15
10111 23
11011 27
11101 29
11110 30
---
Total: 186
PROG
(PARI) a(n)={my(w=0, b=0); for(i=1, n, w+=hammingweight(i); b+=logint(i, 2)+1); sum(j=0, w-1, sum(k=0, b-w, my(t=j+k); if(t, binomial(t, j)*(2^t + j*(2^t-1)/t), 1) ))} \\ Andrew Howroyd, Jan 20 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tamas Sandor Nagy, Jan 20 2024
EXTENSIONS
More terms from Andrew Howroyd, Jan 20 2024
STATUS
approved