cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A358403 The index of A358402 where n first appears, or 0 if n never appears.

This page as a plain text file.
%I A358403 #10 Nov 14 2022 10:00:21
%S A358403 1,3,6,9,25,21,17,109,198,67,860,114,148,261,57,137,82,37,52,215,447,
%T A358403 43,105,404,267,163,414,94,154,1292,184,716,142,669,243,73,1685,126,
%U A358403 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 A358403 The index of A358402 where n first appears, or 0 if n never appears.
%C A358403 See A358402 for further details.
%o A358403 (Python)
%o A358403 from itertools import count, islice
%o A358403 def agen():
%o A358403     k, an, first, prev = 0, 0, {0: 1}, {0: 1}
%o A358403     for n in count(2):
%o A358403         while k in first: yield first[k]; k += 1
%o A358403         an1 = 0 if first[an] == n-1 else min(n-1-prev[an], first[an])
%o A358403         if an1 not in first: first[an1] = prev[an1] = n
%o A358403         prev[an] = n-1
%o A358403         an = an1
%o A358403 print(list(islice(agen(), 62))) # _Michael S. Branicky_, Nov 14 2022
%Y A358403 Cf. A358402, A358405, A358406, A181391.
%K A358403 nonn
%O A358403 0,2
%A A358403 _Scott R. Shannon_, Nov 14 2022