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.
%I A378821 #23 Dec 21 2024 23:52:08 %S A378821 1,2,4,7,11,3,10,18,5,16,26,6,22,35,8,27,42,9,32,51,12,37,58,13,41,66, %T A378821 14,47,74,15,53,83,17,57,90,19,62,98,20,68,106,21,73,115,23,78,122,24, %U A378821 84,131,25,88,138,28,94,147,29,99,154,30,103,162,31,109,170,33 %N A378821 Lexicographically earliest sequence of distinct positive integers such that the count of integers between a(n) and a(n-1), excluding values already in the sequence, is distinct from the same count for any other a(k) and a(k-1) at the time they occurred. %H A378821 Michael S. Branicky, <a href="/A378821/b378821.txt">Table of n, a(n) for n = 1..10000</a> %e A378821 a(1-5) = 1,2,4,7,11 follow a straightforward pattern of counting up, where each pair of consecutive terms encloses (in order) 0,1,2,3 unused values. %e A378821 1,2,3,4,5,6,7,8,9,10,11 %e A378821 1 2 * 4 * * 7 * * * 11 %e A378821 ^ ^ ^ ^ ^ %e A378821 At a(6), a(5)=11 and a(6)=3 enclose 5 unused values: %e A378821 1,2,3,4,5,6,7,8,9,10,11 %e A378821 1 2 3 4 * * 7 * * * 11 %e A378821 ^ ^ %o A378821 (Python) %o A378821 from itertools import count, islice %o A378821 def c(k, m, a): return sum(1 for i in range(min(k, m)+1, max(k, m)) if i not in a) %o A378821 def agen(): # generator of terms %o A378821 a, d, an, m = set(), set(), 1, 2 %o A378821 while True: %o A378821 yield an %o A378821 a.add(an) %o A378821 found, k = False, m %o A378821 if m < an: %o A378821 ck = c(k, an, a) %o A378821 for k in range(m, an): %o A378821 if k not in a: %o A378821 if ck not in d: %o A378821 found = True %o A378821 break %o A378821 ck -= 1 %o A378821 if not found: %o A378821 kk = max(m, an+1) %o A378821 ck = c(kk, an, a) %o A378821 for k in count(kk): %o A378821 if k not in a: %o A378821 if ck not in d: %o A378821 found = True %o A378821 break %o A378821 ck += 1 %o A378821 d.add(c(an, k, a)) %o A378821 an = k %o A378821 while m in a: m += 1 %o A378821 print(list(islice(agen(), 66))) # _Michael S. Branicky_, Dec 09 2024 %Y A378821 Cf. A378822, A081145, A091263. %K A378821 nonn %O A378821 1,2 %A A378821 _Neal Gersh Tolunsky_, Dec 08 2024