login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the sum of numbers whose binary forms can be constructed using some or all of the binary digits of 1..n.
0

%I #17 Jan 29 2024 19:09:46

%S 1,17,186,12234,605714,30143621,865062888,374978871766,92420578210888,

%T 22764626902276757,4227156427366610576,1076625258046594762034,

%U 196829039855755478065982,34737980525681450161565604,3519580168264415862502129296,8186117385516870986118141242073

%N a(n) is the sum of numbers whose binary forms can be constructed using some or all of the binary digits of 1..n.

%e 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:

%e 1 1

%e 10 2

%e 11 3

%e 101 5

%e 110 6

%e 111 7

%e 1011 11

%e 1101 13

%e 1110 14

%e 1111 15

%e 10111 23

%e 11011 27

%e 11101 29

%e 11110 30

%e ---

%e Total: 186

%o (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

%Y Cf. A181132, A000788.

%K nonn,base

%O 1,2

%A _Tamas Sandor Nagy_, Jan 20 2024

%E More terms from _Andrew Howroyd_, Jan 20 2024