OFFSET
0,3
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 ...).
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 0..110 (terms 0..70 from Donovan Johnson, significant extension enabled by programs provided in Code Golf challenge).
Code Golf Stackexchange, Smallest and largest 100-bit square with maximum Hamming weight, fastest code challenge started Dec 15 2022.
Bernt Lindström, On the binary digits of a power, Journal of Number Theory, Volume 65, Issue 2, August 1997, Pages 321-324.
FORMULA
a(n) = 2*A211201(n-1) + 1 for n >= 1. - Hugo Pfoertner, Feb 06 2022
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 19 2013
EXTENSIONS
a(26)-a(40) from Reinhard Zumkeller, Nov 20 2013
STATUS
approved