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.

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