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

A159918 Number of ones in binary representation of n^2.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Apr 25 2009

Keywords

Comments

The binary weight (A000120) of n^2.
a(n) = 0 iff n = 0. a(n) = 1 iff n = 2^k for some k >= 0. a(n) = 2 iff n = 3*2^k for some k >= 0. Szalay proves that a(n) = 3 iff n = 7*2^k, 23*2^k, or 2^a + 2^b for k >= 0 and a > b >= 0. It seems that a(n) = 4 iff n = 13*2^k, 15*2^k, 47*2^k, or 111*2^k but this has not been proven! Any other n with a(n) = 4 are greater than 10^50, and there are finitely many odd solutions. - Charles R Greathouse IV, Jan 20 2022

References

  • L. Szalay, The equations 2^n ± 2^m ± 2^l = z^2, Indagationes Mathematicae (N.S.) 13, no. 1 (2002), pp. 131-142.

Crossrefs

Programs

Formula

a(n) = A000120(A000290(n)); a(A077436(n)) = A000120(A077436(n)).
Lindström shows that lim sup wt(m^2)/log_2 m = 2. - N. J. A. Sloane, Oct 11 2013
a(n) = [x^(n^2)] (1/(1 - x))*Sum_{k>=0} x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Mar 27 2018

A231897 a(n) = smallest m such that wt(m^2) = n (where wt(i) = A000120(i)), or -1 if no such m exists.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Nov 19 2013

Keywords

Comments

Conjecture: a(n) is never -1. (It seems likely that the arguments of Lindström (1997) could be modified to establish this conjecture.)
a(n) is the smallest m such that A159918(m) = n (or -1 if ...).

Crossrefs

A089998 are the corresponding squares.

Programs

  • Haskell
    a231897 n = head [x | x <- [1..], a159918 x == n]
    -- Reinhard Zumkeller, Nov 20 2013
    
  • PARI
    a(n)=if(n,my(k); while(hammingweight(k++^2)!=n,); k, 0) \\ Charles R Greathouse IV, Aug 06 2015
    
  • Python
    def wt(n): return bin(n).count('1')
    def a(n):
        m = 2**(n//2) - 1
        while wt(m**2) != n: m += 1
        return m
    print([a(n) for n in range(32)]) # Michael S. Branicky, Feb 06 2022

Formula

a(n) = 2*A211201(n-1) + 1 for n >= 1. - Hugo Pfoertner, Feb 06 2022

Extensions

a(26)-a(40) from Reinhard Zumkeller, Nov 20 2013

A231898 a(n) = smallest k with property that for all m >= k, there is a square N^2 whose binary expansion contains exactly n 1's and m 0's; or -1 if no such k exists.

Original entry on oeis.org

-1, -1, 2, -1, 4, 3, 4, 3, 4, 5, 5, 5, 6, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
Offset: 1

Views

Author

N. J. A. Sloane, Nov 19 2013

Keywords

Comments

a(n) = -1 for n = 1, 2 and 4, because all squares with exactly 1, 2 or 4 1's in their binary expansion must contain an even number of 0's.
Conjecture: Apart from n=1, 2 and 4, no other a(n) is -1.
See A214560 for a related conjecture.

Examples

			Here is a table whose columns give:
N, N^2, number of bits in N^2, number of 1's in N^2, number of 0's in N^2:
0 0 1 0 1
1 1 1 1 0
2 4 3 1 2
3 9 4 2 2
4 16 5 1 4
5 25 5 3 2
6 36 6 2 4
7 49 6 3 3
8 64 7 1 6
9 81 7 3 4
10 100 7 3 4
11 121 7 5 2
12 144 8 2 6
13 169 8 4 4
14 196 8 3 5
15 225 8 4 4
16 256 9 1 8
17 289 9 3 6
18 324 9 3 6
19 361 9 5 4
...
a(n) is defined by the property that for all m >= a(n), the table contains a row ending n m. For example, there are rows ending 3 2, 3 3, 3 4, 3 5, ..., but not 3 1, so a(3) = 2.
a(5)=4: for t>=0, (11*2^t)^2 contains 5 1's and 2t+2 0's and (25*2^t)^2 contains 5 1's and 2t+5 0's, so for m >= 4 there is a number N such that N^2 contains 5 1's and m 0's. Also 4 is the smallest number with this property, so a(5) = 4.
		

Crossrefs

Extensions

Missing word in definition supplied by Jon Perry, Nov 20 2013.

A214562 Number of 0's in binary expansion of n^n.

Original entry on oeis.org

0, 0, 2, 1, 8, 6, 10, 9, 24, 15, 23, 19, 34, 21, 31, 26, 64, 39, 49, 40, 61, 44, 63, 46, 95, 59, 82, 61, 98, 79, 97, 71, 160, 88, 112, 92, 129, 96, 115, 109, 160, 105, 131, 118, 178, 125, 159, 134, 228, 138, 178, 146, 207, 141, 183, 154, 245, 161, 192, 167, 231, 195
Offset: 0

Views

Author

Alex Ratushnyak, Jul 21 2012

Keywords

Crossrefs

Programs

  • PARI
    vector(66, n, b=binary((n-1)^(n-1)); sum(j=1, #b, 1-b[j])) /* Joerg Arndt, Jul 21 2012 */
  • Python
    for n in range(300):
       c = 0
       b = int(n**n)
       while b>0:
           c += 1-(b&1)
           b//=2
       print( c, end=", ")
    

Formula

a(n) = A023416(A000312(n)).
a(2^k) = k*2^k. - Chai Wah Wu, Dec 24 2024
Showing 1-4 of 4 results.