OFFSET
0,2
EXAMPLE
----------------------------------------------------
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
PROG
(PARI) a(n) = my(k=0); while(hammingweight(k^2) - hammingweight(k) != n, k++); k;
(Python 3.10+)
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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Karl-Heinz Hofmann and Hugo Pfoertner, Oct 17 2022
STATUS
approved