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.

Showing 1-3 of 3 results.

A164343 A positive integer is included if it is a square that contains the same number of 0's as 1's when represented in binary.

Original entry on oeis.org

9, 49, 169, 225, 625, 841, 961, 2916, 3249, 3721, 3969, 10609, 12100, 12769, 13924, 14641, 15625, 16129, 39601, 41209, 42849, 44944, 45369, 45796, 47524, 52900, 56644, 58081, 60516, 62001, 64009, 65025, 151321, 154449, 155236, 156025, 161604, 163216, 167281
Offset: 1

Views

Author

Leroy Quet, Aug 13 2009

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[500]^2,DigitCount[#,2,1]==DigitCount[#,2,0]&] (* Harvey P. Dale, Nov 18 2014 *)
  • Python
    def bal(n): return n and n.bit_length() == n.bit_count() * 2
    print([s for s in (k*k for k in range(403)) if bal(s)]) # Michael S. Branicky, Jul 12 2022

Extensions

More terms from Sean A. Irvine, Oct 08 2009

A356878 a(n) is the least number of binary zeros of squares with binary weight n.

Original entry on oeis.org

1, 0, 2, 2, 4, 2, 3, 4, 3, 4, 5, 5, 5, 2, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 7, 6, 8, 9, 6, 7, 8, 9, 8, 9, 9, 8, 10, 9, 9, 10, 9, 9, 9, 9, 10, 10, 10, 11, 10
Offset: 0

Views

Author

Karl-Heinz Hofmann, Sep 30 2022

Keywords

Examples

			    Squares with    |             possible number of zeros
    binary weight   |  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 ...
         n          |            the leftmost value is a(n)
   -----------------+----------------------------------------------------
         0          |  -  1  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
         1          |  0  -  2  -  4  -  6  -  8  - 10  - 12  - 14  - ...
         2          |  -  -  2  -  4  -  6  -  8  - 10  - 12  - 14  - ...
         3          |  -  -  2  3  4  5  6  7  8  9 10 11 12 13 14 15 ...
         4          |  -  -  -  -  4  -  6  -  8  - 10  - 12  - 14  - ...
         5          |  -  -  2  -  4  5  6  7  8  9 10 11 12 13 14 15 ...
         6          |  -  -  -  3  4  5  6  7  8  9 10 11 12 13 14 15 ...
         7          |  -  -  -  -  4  5  6  7  8  9 10 11 12 13 14 15 ...
         8          |  -  -  -  3  4  5  6  7  8  9 10 11 12 13 14 15 ...
         9          |  -  -  -  -  4  5  6  7  8  9 10 11 12 13 14 15 ...
        10          |  -  -  -  -  -  5  6  7  8  9 10 11 12 13 14 15 ...
        11          |  -  -  -  -  -  5  6  7  8  9 10 11 12 13 14 15 ...
        12          |  -  -  -  -  -  5  6  7  8  9 10 11 12 13 14 15 ...
        13          |  -  -  2  -  4  -  6  7  8  9 10 11 12 13 14 15 ...
        14          |  -  -  -  -  -  5  6  7  8  9 10 11 12 13 14 15 ...
         :          |  ...
		

Crossrefs

A357750 a(n) is the least k such that B(k^2) - B(k) = n, where B(m) is the binary weight A000120(m).

Original entry on oeis.org

0, 5, 11, 21, 45, 75, 217, 331, 181, 789, 1241, 2505, 5701, 5221, 11309, 19637, 43151, 69451, 82709, 166027, 346389, 607307, 689685, 1458357, 1380917, 2507541, 5906699, 2965685, 5931189, 11862197, 47448787, 82188309, 57804981, 94905541, 188883211, 373457573, 640164021
Offset: 0

Views

Author

Keywords

Examples

			  ----------------------------------------------------
  n     k      k^2     binary k             binary k^2
  ----------------------------------------------------
  0     0        0            0                      0
  1     5       25          101                  11001
  2    11      121         1011                1111001
  3    21      441        10101              110111001
  4    45     2025       101101            11111101001
  5    75     5625      1001011          1010111111001
  6   217    47089     11011001       1011011111110001
  7   331   109561    101001011      11010101111111001
  8   181    32761     10110101        111111111111001
  9   789   622521   1100010101   10010111111110111001
		

Crossrefs

Programs

  • PARI
    a(n) = my(k=0); while(hammingweight(k^2) - hammingweight(k) != n, k++); k;
    
  • Python
    from itertools import count
    def A357750(n):
        for k in count(0):
            if (k**2).bit_count()-k.bit_count()==n:
                return k # Chai Wah Wu, Oct 17 2022
Showing 1-3 of 3 results.