login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A159918 Number of ones in binary representation of n^2. 38

%I #42 Jan 21 2022 21:55:40

%S 0,1,1,2,1,3,2,3,1,3,3,5,2,4,3,4,1,3,3,5,3,6,5,3,2,5,4,6,3,5,4,5,1,3,

%T 3,5,3,6,5,7,3,5,6,7,5,8,3,4,2,5,5,5,4,8,6,7,3,6,5,7,4,6,5,6,1,3,3,5,

%U 3,6,5,7,3,6,6,9,5,7,7,5,3,6,5,8,6,7,7,7,5,9,8,5,3,6,4,5,2,5,5,6,5,9,5,7,4

%N Number of ones in binary representation of n^2.

%C The binary weight (A000120) of n^2.

%C a(n) = 0 iff n = 0. a(n) = 1 iff n = 2^k for some k >= 0. a(n) = 2 iff n = 3*2^k for some k >= 0. Szalay proves that a(n) = 3 iff n = 7*2^k, 23*2^k, or 2^a + 2^b for k >= 0 and a > b >= 0. It seems that a(n) = 4 iff n = 13*2^k, 15*2^k, 47*2^k, or 111*2^k but this has not been proven! Any other n with a(n) = 4 are greater than 10^50, and there are finitely many odd solutions. - _Charles R Greathouse IV_, Jan 20 2022

%D L. Szalay, The equations 2^n ± 2^m ± 2^l = z^2, Indagationes Mathematicae (N.S.) 13, no. 1 (2002), pp. 131-142.

%H Nathaniel Johnston, <a href="/A159918/b159918.txt">Table of n, a(n) for n = 0..10000</a>

%H Bernt Lindström, <a href="http://dx.doi.org/10.1006/jnth.1997.2129">On the binary digits of a power</a>, Journal of Number Theory, Volume 65, Issue 2, August 1997, Pages 321-324.

%H Nick MacKinnon, <a href="https://doi.org/10.1080/00029890.2019.1647063">Problems and Solutions #12140</a>, The American Mathematical Monthly, 126:9 (2019), 850.

%H K. B. Stolarsky, <a href="http://dx.doi.org/10.1090/S0002-9939-1978-0495823-5">The binary digits of a power</a>, Proc. Amer. Math. Soc. 71 (1978), 1-5.

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = A000120(A000290(n)); a(A077436(n)) = A000120(A077436(n)).

%F Lindström shows that lim sup wt(m^2)/log_2 m = 2. - _N. J. A. Sloane_, Oct 11 2013

%F a(n) = [x^(n^2)] (1/(1 - x))*Sum_{k>=0} x^(2^k)/(1 + x^(2^k)). - _Ilya Gutkovskiy_, Mar 27 2018

%p A159918 := proc(n) return add(b, b=convert(n^2, base, 2)): end: seq(A159918(n), n=0..100); # _Nathaniel Johnston_, Jun 23 2011

%t a[n_] := Total[IntegerDigits[n^2, 2]];

%t Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Oct 27 2021 *)

%o (Haskell)

%o a159918 = a000120 . a000290 -- _Reinhard Zumkeller_, Oct 12 2013

%o (Python)

%o def A159918(n):

%o return bin(n*n).count('1') # _Chai Wah Wu_, Sep 03 2014

%o (PARI) a(n)=hammingweight(n^2) \\ _Charles R Greathouse IV_, Aug 06 2015

%Y Cf. A000120, A007088, A192085, A004159, A214560, A231897, A231898. For records see A230097.

%K nonn,base,easy

%O 0,4

%A _Reinhard Zumkeller_, Apr 25 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 12:44 EDT 2024. Contains 371913 sequences. (Running on oeis4.)