[go: up one dir, main page]

login
A358406
The index of A358405 where n first appears, or 0 if n never appears.
3
1, 3, 5, 10, 16, 8, 19, 141, 14, 190, 25, 22, 416, 70, 54, 162, 32, 308, 169, 67, 93, 203, 118, 513, 196, 29, 40, 200, 861, 37, 74, 1081, 82, 216, 208, 363, 90, 46, 375, 1675, 1091, 333, 1407, 812, 166, 78, 51, 1099, 115, 193, 1243, 64, 595, 98, 58, 367, 617, 235, 325, 766, 2137, 272, 124
OFFSET
0,2
COMMENTS
See A358405 for further details.
PROG
(Python)
from itertools import count, islice
def agen():
k, an, first, prev = 0, 0, {0: 1}, {0: 1}
for n in count(2):
while k in first: yield first[k]; k += 1
an1 = 0 if first[an] == n-1 else max(n-1-prev[an], first[an])
if an1 not in first: first[an1] = prev[an1] = n
prev[an] = n-1
an = an1
print(list(islice(agen(), 63))) # Michael S. Branicky, Nov 14 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Nov 14 2022
STATUS
approved