login
a(n) is the least k such that A366912(k) = n.
2

%I #19 Oct 28 2023 23:53:10

%S 1,2,3,4,9,10,23,28,29,84,170,353,805,850,2171,4860,11815,28025,31539,

%T 131252,318231,406904,1612758,2461032,9917597,11551434,36824781,

%U 80492173,206009383,505512671,1361256869,2467754261

%N a(n) is the least k such that A366912(k) = n.

%C a(n) corresponds to the index of the first term of A364054 with height n.

%H Rémy Sigrist, <a href="/A366913/a366913.gp.txt">PARI program</a>

%H Rémy Sigrist, <a href="/A366913/a366913.txt">C++ program</a>

%o (PARI) See Links section.

%o (C++) See Links section.

%o (Python)

%o from itertools import count

%o from sympy import nextprime

%o def A366913(n):

%o a, aset, p, c = 1, {0,1}, 2, 0

%o for i in count(1):

%o if c == n:

%o return i

%o k, b = divmod(a,p)

%o for j in count(-k):

%o if b not in aset:

%o aset.add(b)

%o a, p = b, nextprime(p)

%o c += j

%o break

%o b += p # _Chai Wah Wu_, Oct 27 2023

%Y Cf. A064290, A364054, A366912.

%K nonn,more

%O 0,2

%A _Rémy Sigrist_, Oct 27 2023

%E a(29) from _Chai Wah Wu_, Oct 27 2023

%E a(30)-a(31) from _Chai Wah Wu_, Oct 28 2023