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-7 of 7 results.

A357659 a(n) is the least k such that k^2 has a maximal Hamming weight A357658(n) in the range 2^n <= k^2 < 2^(n+1).

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 21, 27, 45, 53, 75, 101, 181, 217, 362, 437, 627, 923, 1241, 1619, 2505, 3915, 5221, 6475, 11309, 15595, 19637, 31595, 44491, 61029, 69451, 113447, 185269, 244661, 357081, 453677, 642119, 980853, 1380917, 1961706, 2965685, 3923411, 5931189, 8096813
Offset: 2

Views

Author

Hugo Pfoertner, Oct 09 2022

Keywords

Examples

			See A357658.
		

Crossrefs

A357660 a(n) is the largest k such that k^2 has a maximal Hamming weight A357658(n) in the range 2^n <= k^2 < 2^(n+1).

Original entry on oeis.org

2, 3, 5, 7, 11, 15, 21, 27, 45, 53, 89, 117, 181, 235, 362, 491, 723, 949, 1241, 1773, 2891, 3915, 5747, 7093, 11309, 16203, 19637, 31595, 44491, 64747, 86581, 113447, 185269, 244661, 357081, 453677, 738539, 980853, 1481453, 2079669, 2965685, 3923411, 5931189, 8222581
Offset: 2

Views

Author

Hugo Pfoertner, Oct 09 2022

Keywords

Examples

			See A357658.
		

Crossrefs

A230097 Indices of records in A159918.

Original entry on oeis.org

0, 1, 3, 5, 11, 21, 39, 45, 75, 155, 181, 627, 923, 1241, 2505, 3915, 5221, 6475, 11309, 15595, 19637, 31595, 44491, 69451, 113447, 185269, 244661, 357081, 453677, 908091, 980853, 2960011, 2965685, 5931189, 11862197, 20437147, 22193965, 43586515, 57804981, 157355851
Offset: 1

Views

Author

N. J. A. Sloane, Oct 11 2013

Keywords

Comments

The records themselves are not so interesting: 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, ... (A357304).
Lindström mentions that the record value 34 in A159918 is first reached at n = 980853.

Crossrefs

Programs

  • Haskell
    a230097 n = a230097_list !! (n-1)
    a230097_list = 0 : f 0 0 where
       f i m = if v > m then i : f (i + 1) v else f (i + 1) m
               where v = a159918 i
    -- Reinhard Zumkeller, Oct 12 2013
    (Python 3.10+)
    from itertools import count, islice
    def A230097_gen(): # generator of terms
        c = -1
        for n in count(0):
            if (m := (n**2).bit_count())>c:
                yield n
                c = m
    A230097_list = list(islice(A230097_gen(),20)) # Chai Wah Wu, Oct 01 2022

Formula

Lindström shows that lim sup wt(m^2)/log_2 m = 2.

Extensions

a(19)-a(40) from Reinhard Zumkeller, Oct 12 2013

A357304 Records of the Hamming weight of squares.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 87, 88, 89
Offset: 1

Views

Author

Hugo Pfoertner, Oct 01 2022

Keywords

Examples

			a(70) = 77 corresponds to A230097(70) = 34895284158283. Its square 1217680856487316499797508089 is the smallest and the only 90-bit square with this Hamming weight.
		

Crossrefs

A230097 gives the values of k such that A000120(k^2) sets a new record.

Extensions

Missing a(68)=75 and a(71)-a(80) from Bert Dobbelaere, Nov 20 2022

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

A352631 Minimum number of zeros in a binary n-digit perfect square, or -1 if there are no such numbers.

Original entry on oeis.org

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

Views

Author

Martin Ehrenstein, Mar 25 2022

Keywords

Comments

Is there a formula that is easy to compute?

Examples

			a(6) = 3, because there are two 6-bit squares 36 = 100100_2 and 49 110001_2 with 4 and 3 zeros, respectively.
a(2) = -1, because the first two perfect squares 1 = 1_2 and 4 = 100_2 have 1 and 3 bits, respectively.
		

Crossrefs

Cf. A357658 (maximum 1's).

Programs

  • Python
    from gmpy2 import is_square, popcount
    for n in range(1, 33):
        m=n+1
        for k in range(2**(n-1), 2**n):
            if is_square(k):
                m=min(m, n-popcount(k))
        print(n, -1 if m>n else m)
    
  • Python
    from math import isqrt
    def A352631(n): return -1 if n == 2 else min(n-(k**2).bit_count() for k in range(1+isqrt(2**(n-1)-1),1+isqrt(2**n))) # Chai Wah Wu, Mar 28 2022

Extensions

a(43)-a(71) from Pontus von Brömssen, Mar 26 2022
a(72)-a(80) from Chai Wah Wu, Apr 01 2022

A357742 a(n) is the maximum binary weight of the squares of n-bit numbers.

Original entry on oeis.org

1, 2, 3, 5, 6, 8, 9, 13, 13, 15, 16, 18, 20, 22, 24, 25, 27, 29, 31, 34, 34, 37, 38, 39, 41, 44, 44, 47, 49, 51, 52, 54, 55, 57, 59, 63, 63, 64, 66, 68, 69, 72, 73, 76, 77, 78, 80, 82, 85, 87
Offset: 1

Views

Author

Keywords

Examples

			   bit   |
  length |          possible binary weight of k^2
   of k  | 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
   = n   |          the rightmost value is a(n)
  -------+--------------------------------------------------------------
     1   | 0  1
     2   |    1  2  -  -
     3   |    1  2  3  -  -  -
     4   |    1  2  3  4  5  -  -  -
     5   |    1  2  3  4  5  6  -  -  -  -
     6   |    1  2  3  4  5  6  7  8  -  -  -  -
     7   |    1  2  3  4  5  6  7  8  9  -  -  -  -  -
     8   |    1  2  3  4  5  6  7  8  9 10 11  - 13  -  -  -
     9   |    1  2  3  4  5  6  7  8  9 10 11 12 13  -  -  -  -  -
    10   |    1  2  3  4  5  6  7  8  9 10 11 12 13 14 15  -  -  -  -  -
		

Crossrefs

Formula

a(n) = max(A357658(2*n-2), A357658(2*n-1)).

Extensions

a(47)-a(50) from Martin Ehrenstein, Dec 26 2023
Showing 1-7 of 7 results.