login
If n = Sum_{i=1..h} 2^b_i with b_1 > ... > b_h >= 0, then a(n) = Sum_{i=1..h} i * 2^b_i.
3

%I #18 Apr 19 2024 03:26:08

%S 0,1,2,4,4,6,8,11,8,10,12,15,16,19,22,26,16,18,20,23,24,27,30,34,32,

%T 35,38,42,44,48,52,57,32,34,36,39,40,43,46,50,48,51,54,58,60,64,68,73,

%U 64,67,70,74,76,80,84,89,88,92,96,101,104,109,114,120,64,66

%N If n = Sum_{i=1..h} 2^b_i with b_1 > ... > b_h >= 0, then a(n) = Sum_{i=1..h} i * 2^b_i.

%C This sequence is similar to A298011.

%H Rémy Sigrist, <a href="/A298043/b298043.txt">Table of n, a(n) for n = 0..8192</a>

%F a(n) = Sum_{k = 0..A000120(n)-1} A053645^k(n) for any n > 0 (where A053645^k denotes the k-th iterate of A053645).

%F a(n) >= n with equality iff n = 0 or n = 2^k for some k >= 0.

%F a(2 * n) = 2 * a(n).

%F a(2^n - 1) = A000295(n + 1).

%F a(2 ^ i + n) = a(n) + 2 ^ i + n for 2 ^ i > n. - _David A. Corneth_, Jan 14 2018

%e For n = 42:

%e 42 = 32 + 8 + 2,

%e hence a(42) = 1*32 + 2*8 + 3*2 = 54.

%o (PARI) a(n) = my (b=binary(n), z=0); for (i=1, #b, if (b[i], b[i] = z++)); return (from digits(b,2))

%Y Cf. A000120, A000295, A053645.

%Y Cf. A083741, A298011.

%K nonn,base,easy

%O 0,3

%A _Rémy Sigrist_, Jan 11 2018