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.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Aug 13 2009

Keywords

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

Crossrefs

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

Programs

  • 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 *)
  • 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

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

Extensions

More terms from Sean A. Irvine, Oct 08 2009