OFFSET
1,2
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
PROG
(Python)
from itertools import count
def A368383(n):
a, aset, p = 1, {0, 1}, 2
for c in count(1):
if a==n: return c
for b in count(a%p, p):
if b not in aset:
aset.add(b)
a, p = b, 3 if p == 2 else p+2
break # Chai Wah Wu, Mar 05 2024
(Python) # faster for initial segment of sequence
adict, n = dict(), 1
for i, v in enumerate(A368382_gen(), 1):
if v >= n and v not in adict:
adict[v] = i
while n in adict:
yield adict[n]; del adict[n]; n += 1
print(list(islice(A368383_gen(), 63))) # Michael S. Branicky, Apr 18 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Mar 03 2024
STATUS
approved