login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

n times the number of 1's in the binary expansion of n.
6

%I #28 Mar 20 2023 14:36:44

%S 0,1,2,6,4,10,12,21,8,18,20,33,24,39,42,60,16,34,36,57,40,63,66,92,48,

%T 75,78,108,84,116,120,155,32,66,68,105,72,111,114,156,80,123,126,172,

%U 132,180,184,235,96,147,150,204,156,212,216,275,168,228,232,295,240

%N n times the number of 1's in the binary expansion of n.

%H Jens Kruse Andersen, <a href="/A245788/b245788.txt">Table of n, a(n) for n = 0..1000</a>

%H Project Euler, <a href="https://projecteuler.net/problem=759">Problem 759</a>, sequence f(n).

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

%F a(2*n+1) = 2*n + 1 + (2+1/n)*a(n). - _Robert Israel_, Aug 01 2014

%F G.f.: x * (d/dx) (1/(1 - x))*Sum_{k>=0} x^(2^k)/(1 + x^(2^k)). - _Ilya Gutkovskiy_, Mar 27 2018

%e G.f. = x + 2*x^2 + 6*x^3 + 4*x^4 + 10*x^5 + 12*x6 + 21*x^7 + 8*x^8 + 18*x^9 + ...

%p a:= n -> n * convert(convert(n,base,2),`+`):

%p seq(a(n),n=0..100); # _Robert Israel_, Aug 01 2014

%t Table[n*DigitCount[n,2,1],{n,0,100}] (* _Harvey P. Dale_, Dec 16 2014 *)

%o (PARI) sumbit(n) = my(r);while(n>0,r+=n%2;n\=2);r

%o a(n) = n*sumbit(n)

%o (PARI) {a(n) = if( n<0, 0, n * sumdigits(n, 2))}; /* _Michael Somos_, Aug 05 2014 */ /* since version 2.6.0 */

%o (Python) [n*bin(n)[2:].count('1') for n in range(1000)] # _Chai Wah Wu_, Aug 03 2014

%Y Cf. A000120 (number of 1's), A057147 (decimal version).

%K nonn,base

%O 0,3

%A _Franklin T. Adams-Watters_, Aug 01 2014