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 A366691 #55 Oct 27 2023 10:03:07 %S A366691 1,1,2,1,3,4,2,5,6,3,7,4,8,2,9,5,10,11,6,12,3,13,14,7,15,4,16,17,8,18, %T A366691 2,19,20,21,9,22,5,23,24,10,25,11,26,6,27,28,12,29,30,13,31,14,32,7, %U A366691 33,15,34,35,36,16,37,17,38,8,39,18,40,41,19,42,43,20 %N A366691 Lexicographically earliest sequence such that each set of terms enclosed by two equal values, excluding the endpoints, contains a distinct number of elements. %C A366691 The word 'set' means that every element is unique. For example, the set {1,1,2} contains 2 elements (not 3). %C A366691 Note that we are considering sets between every pair of equal values, not just those that appear consecutively. %C A366691 Two consecutive values enclose 0 terms, and thus after [a(1), a(2)] = [1, 1], no consecutive equal values occur again. %H A366691 Neal Gersh Tolunsky, <a href="/A366691/b366691.txt">Table of n, a(n) for n = 1..10000</a> %H A366691 Rémy Sigrist, <a href="/A366691/a366691.gp.txt">PARI program</a> %e A366691 a(1)=1; no pair of terms exists yet. %e A366691 a(2)=1 creates the pair [1, 1], which encloses 0 elements. This means that no consecutive equal values can occur again, since this would create another set of 0 elements. %e A366691 a(3)=2 because if a(3)=1, this would create a second pair enclosing 0 elements. %e A366691 a(4)=1 creates two new sets: [1, 2, 1], enclosing 1 element {2}, and [1, 1, 2, 1], enclosing 2 elements {1, 2}. %e A366691 a(5) cannot be 1 as this would again create a pair enclosing 0 elements [1,1]. 2 would create the pair [2, 1, 2] which encloses 1 element {1}, which has been impossible since a(4). So a(5)=3, which has not occurred before. %o A366691 (PARI) See Links section. %o A366691 (Python) %o A366691 from itertools import islice %o A366691 def agen(): # generator of terms %o A366691 e, a = set(), [] %o A366691 while True: %o A366691 an, allnew = 0, False %o A366691 while not allnew: %o A366691 allnew, an, ndset = True, an+1, set() %o A366691 for i in range(len(a)): %o A366691 if an == a[i]: %o A366691 nd = len(set(a[i+1:])) %o A366691 if nd in e or nd in ndset: allnew = False; break %o A366691 ndset.add(nd) %o A366691 yield an; a.append(an); e |= ndset %o A366691 print(list(islice(agen(), 72))) # _Michael S. Branicky_, Oct 25 2023 %Y A366691 Cf. A337226 (with nondistinct terms counted), A330896, A363757, A366631. %K A366691 nonn %O A366691 1,3 %A A366691 _Neal Gersh Tolunsky_, Oct 17 2023 %E A366691 More terms from _Rémy Sigrist_, Oct 25 2023