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”).

A164344
Positive integers whose square contains the same number of 0's as 1's when represented in binary.
4
3, 7, 13, 15, 25, 29, 31, 54, 57, 61, 63, 103, 110, 113, 118, 121, 125, 127, 199, 203, 207, 212, 213, 214, 218, 230, 238, 241, 246, 249, 253, 255, 389, 393, 394, 395, 402, 404, 409, 421, 431, 433, 435, 439, 458, 468, 478, 481, 486, 494, 497, 502, 505, 509, 511
OFFSET
1,1
COMMENTS
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
LINKS
James Propp et al., Perfectly balanced perfect squaresmath-fun mailing list (archive available to subscribers), Jul 12 2022.
FORMULA
{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
MATHEMATICA
sn01Q[n_]:=Module[{idn2=IntegerDigits[n^2, 2]}, Count[idn2, 1] == Length[ idn2]/2]; Select[Range[600], sn01Q] (* Harvey P. Dale, Apr 03 2016 *)
PROG
(PARI) select( {is_A164344(n)=hammingweight(n^2)*2==exponent(n^2*2)}, [0..512]) \\ M. F. Hasler, Jul 12 2022
(Python)
def bal(n): return n and n.bit_length() == n.bit_count() * 2
print([k for k in range(512) if bal(k*k)]) # Michael S. Branicky, Jul 12 2022
CROSSREFS
Cf. A031443 (digitally balanced numbers), A164343 (squares of the terms), A000120 (Hamming weight), A070939 (number of binary digits).
Sequence in context: A002236 A255682 A080565 * A002254 A356211 A331036
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Aug 13 2009
EXTENSIONS
More terms from Sean A. Irvine, Oct 08 2009
STATUS
approved