%I #10 Nov 14 2022 10:00:21
%S 1,3,6,9,25,21,17,109,198,67,860,114,148,261,57,137,82,37,52,215,447,
%T 43,105,404,267,163,414,94,154,1292,184,716,142,669,243,73,1685,126,
%U 360,209,329,324,355,88,542,300,887,366,422,492,1053,1754,256,941,946,711,679,178,283,3273,2221,225
%N The index of A358402 where n first appears, or 0 if n never appears.
%C See A358402 for further details.
%o (Python)
%o from itertools import count, islice
%o def agen():
%o k, an, first, prev = 0, 0, {0: 1}, {0: 1}
%o for n in count(2):
%o while k in first: yield first[k]; k += 1
%o an1 = 0 if first[an] == n-1 else min(n-1-prev[an], first[an])
%o if an1 not in first: first[an1] = prev[an1] = n
%o prev[an] = n-1
%o an = an1
%o print(list(islice(agen(), 62))) # _Michael S. Branicky_, Nov 14 2022
%Y Cf. A358402, A358405, A358406, A181391.
%K nonn
%O 0,2
%A _Scott R. Shannon_, Nov 14 2022