cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A164344 #22 Jan 08 2025 11:17:59
%S A164344 3,7,13,15,25,29,31,54,57,61,63,103,110,113,118,121,125,127,199,203,
%T A164344 207,212,213,214,218,230,238,241,246,249,253,255,389,393,394,395,402,
%U A164344 404,409,421,431,433,435,439,458,468,478,481,486,494,497,502,505,509,511
%N A164344 Positive integers whose square contains the same number of 0's as 1's when represented in binary.
%C A164344 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 A164344 Harvey P. Dale, <a href="/A164344/b164344.txt">Table of n, a(n) for n = 1..1000</a>
%H A164344 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 A164344 {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 A164344 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 A164344 (PARI) select( {is_A164344(n)=hammingweight(n^2)*2==exponent(n^2*2)}, [0..512]) \\ _M. F. Hasler_, Jul 12 2022
%o A164344 (Python)
%o A164344 def bal(n): return n and n.bit_length() == n.bit_count() * 2
%o A164344 print([k for k in range(512) if bal(k*k)]) # _Michael S. Branicky_, Jul 12 2022
%Y A164344 Cf. A031443 (digitally balanced numbers), A164343 (squares of the terms), A000120 (Hamming weight), A070939 (number of binary digits).
%K A164344 base,nonn
%O A164344 1,1
%A A164344 _Leroy Quet_, Aug 13 2009
%E A164344 More terms from _Sean A. Irvine_, Oct 08 2009