login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A366913
a(n) is the least k such that A366912(k) = n.
2
1, 2, 3, 4, 9, 10, 23, 28, 29, 84, 170, 353, 805, 850, 2171, 4860, 11815, 28025, 31539, 131252, 318231, 406904, 1612758, 2461032, 9917597, 11551434, 36824781, 80492173, 206009383, 505512671, 1361256869, 2467754261
OFFSET
0,2
COMMENTS
a(n) corresponds to the index of the first term of A364054 with height n.
LINKS
PROG
(PARI) See Links section.
(C++) See Links section.
(Python)
from itertools import count
from sympy import nextprime
def A366913(n):
a, aset, p, c = 1, {0, 1}, 2, 0
for i in count(1):
if c == n:
return i
k, b = divmod(a, p)
for j in count(-k):
if b not in aset:
aset.add(b)
a, p = b, nextprime(p)
c += j
break
b += p # Chai Wah Wu, Oct 27 2023
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Rémy Sigrist, Oct 27 2023
EXTENSIONS
a(29) from Chai Wah Wu, Oct 27 2023
a(30)-a(31) from Chai Wah Wu, Oct 28 2023
STATUS
approved