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!)
A164344 Positive integers whose square contains the same number of 0's as 1's when represented in binary. 4

%I #20 Jul 13 2022 14:49:50

%S 3,7,13,15,25,29,31,54,57,61,63,103,110,113,118,121,125,127,199,203,

%T 207,212,213,214,218,230,238,241,246,249,253,255,389,393,394,395,402,

%U 404,409,421,431,433,435,439,458,468,478,481,486,494,497,502,505,509,511

%N Positive integers whose square contains the same number of 0's as 1's when represented in binary.

%C The squares must have an even number of binary digits, given by ceiling(log_2(a(n)^2)) = ceiling(2 log_2 a(n)), or equivalently, 2^(k-1/2) < a(n) < 2^k for some integer k > 0, which explains the jumps in the graph of the sequence. - _M. F. Hasler_, Jul 12 2022

%H Harvey P. Dale, <a href="/A164344/b164344.txt">Table of n, a(n) for n = 1..1000</a>

%H James Propp et al., <a href="https://mailman.xmission.com/hyperkitty/list/math-fun@mailman.xmission.com/thread/ABJYBY4XWNAXLLMEIEKTE622UBEBHITA/">Perfectly balanced perfect squares</a>math-fun mailing list (archive available to subscribers), Jul 12 2022.

%F {n | n^2 is in A031443} = {n | 2*A000120(n^2) = A070939(n^2)}, i.e., twice the Hamming weight must equal the number of binary digits, for the squares of the terms. - _M. F. Hasler_, Jul 12 2022

%t sn01Q[n_]:=Module[{idn2=IntegerDigits[n^2,2]},Count[idn2,1] == Length[ idn2]/2]; Select[Range[600],sn01Q] (* _Harvey P. Dale_, Apr 03 2016 *)

%o (PARI) select( {is_A164344(n)=hammingweight(n^2)*2==exponent(n^2*2)}, [0..512]) \\ _M. F. Hasler_, Jul 12 2022

%o (Python)

%o def bal(n): return n and n.bit_length() == n.bit_count() * 2

%o print([k for k in range(512) if bal(k*k)]) # _Michael S. Branicky_, Jul 12 2022

%Y Cf. A031443 (digitally balanced numbers), A164343 (squares of the terms), A000120 (Hamming weight), A070939 (number of binary digits).

%K base,nonn

%O 1,1

%A _Leroy Quet_, Aug 13 2009

%E More terms from _Sean A. Irvine_, Oct 08 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 18 20:26 EDT 2024. Contains 371781 sequences. (Running on oeis4.)