login
A357750
a(n) is the least k such that B(k^2) - B(k) = n, where B(m) is the binary weight A000120(m).
2
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,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
KEYWORD
nonn,base
AUTHOR
STATUS
approved