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 A363654 #32 Jul 25 2023 09:14:47 %S A363654 1,2,1,3,2,3,1,2,4,3,4,5,3,6,7,4,3,8,6,9,7,8,4,10,3,7,4,6,8,9,11,10, %T A363654 12,3,9,13,7,3,11,9,14,15,13,16,17,7,18,3,19,20,11,14,9,20,17,15,19, %U A363654 20,18,21,11,22,3,23,24,25,26,14,17,9,27,28,29,15,26,19 %N A363654 Lexicographically earliest sequence of positive integers such that the n-th pair of identical terms encloses exactly a(n) terms. %C A363654 Pairs are numbered according to the position of the second term. %H A363654 Neal Gersh Tolunsky, <a href="/A363654/b363654.txt">Table of n, a(n) for n = 1..10000</a> %H A363654 Eric Angelini, <a href="http://cinquantesignes.blogspot.com/2023/06/a-seq-with-strange-behavior-or-not.html">A seq with a strange behavior (or not)?</a> %H A363654 Neal Gersh Tolunsky, <a href="/A363654/a363654.png">Scatterplot of first 100000 terms</a> %e A363654 a(1) = 1. The 1st constructed pair encloses 1 term: [1, 2, 1]. %e A363654 a(2) = 2. The 2nd constructed pair encloses 2 terms: [2, 1, 3, 2]. %e A363654 a(3) = 1. The 3rd constructed pair encloses 1 term: [3, 2, 3]. %e A363654 a(4) = 3. The 4th constructed pair encloses 3 terms: [1, 3, 2, 3, 1]. %e A363654 a(5) = 2. The 5th constructed pair encloses 2 terms: [2, 3, 1, 2]. %e A363654 a(6) = 3. The 6th constructed pair encloses 3 terms: [3, 1, 2, 4, 3]. %e A363654 a(7) = 1. The 7th constructed pair encloses 1 term: [4, 3, 4]. %e A363654 ... %o A363654 (Python) %o A363654 from itertools import count, islice %o A363654 def agen(): # generator of terms %o A363654 a, indexes = [1], {1: 0} %o A363654 yield a[-1] %o A363654 for i in count(0): %o A363654 num = 1 %o A363654 while True: %o A363654 if num in indexes: %o A363654 if (len(a) - indexes[num]) == (a[i]+1): %o A363654 an = num; indexes[an] = len(a); a.append(an); yield an %o A363654 break %o A363654 else: %o A363654 num += 1 %o A363654 else: %o A363654 an = max(a)+1; indexes[an] = len(a); a.append(an); yield an %o A363654 num = 1 %o A363654 print(list(islice(agen(), 100))) # _Gavin Lupo_ and _Michael S. Branicky_, Jun 13 2023 %Y A363654 Cf. A026272, A363708, A363757. %K A363654 nonn %O A363654 1,2 %A A363654 _Eric Angelini_ and _Gavin Lupo_, Jun 13 2023