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 A358921 #25 Jan 13 2023 09:19:35 %S A358921 1,2,1,3,1,2,3,1,4,1,5,1,2,3,4,1,6,1,7,1,5,2,3,4,1,8,1,9,1,6,2,3,4,1, %T A358921 5,2,6,1,7,2,3,4,5,1,8,2,6,3,7,1,9,2,4,5,3,6,1,10,1,11,1,12,1,13,1,14, %U A358921 1,8,2,3,4,5,6,1,7,2,9,1,15,1,16,1,17,1 %N A358921 a(1) = 1; a(n) is the smallest positive number not among the terms a(n-c .. n-1) where c = the number of times a(n-1) has occurred. %C A358921 A new number other than 1 is always followed by a 1, so a(n) < n/2 for n > 4. %H A358921 Samuel Harkness, <a href="/A358921/b358921.txt">Table of n, a(n) for n = 1..10000</a> %H A358921 Samuel Harkness, <a href="/A358921/a358921.jpg">Scatterplot of the first 2000000 terms</a> %e A358921 For a(6), a(5) = 1 has occurred 3 times, so the smallest positive integer not in {a(5), a(4), a(3)} = {1, 3, 1} is 2, thus a(6) = 2. %e A358921 Next, for a(7), a(6) = 2 has occurred 2 times, so the smallest positive integer not in {a(6), a(5)} = {2, 1} is 3, thus a(7) = 3. %e A358921 Then, for a(8), a(7) = 3 has occurred 2 times, so the smallest positive integer not in {a(7), a(6)} = {3, 2} is 1, thus a(8) = 1. %e A358921 Now, for a(9), a(8) = 1 has occurred 4 times, so the smallest positive integer not in {a(8), a(7), a(6), a(5)} = {1, 3, 2, 1} is 4, thus a(9) = 4. %e A358921 The first terms, alongside the number of times they have occurred o(n), are: %e A358921 n a(n) o(n) %e A358921 - ---- ---- %e A358921 1 1 1 %e A358921 2 2 1 %e A358921 3 1 2 %e A358921 4 3 1 %e A358921 5 1 3 %e A358921 6 2 2 %e A358921 7 3 2 %e A358921 8 1 4 %e A358921 9 4 1 %e A358921 10 1 5 %t A358921 V = {1} While[Length[V] < 84, b = 1; While[MemberQ[Take[V, -Count[V, Last[V]]], b], b++ ]; AppendTo[V, b]]; Print[V] %o A358921 (PARI) { a = o = vector(84); v = 1; for (n=1, #a, print1 (a[n]=v", "); v=setminus([1..n+1], Set(a[n-o[a[n]]+++1..n]))[1]) } \\ _Rémy Sigrist_, Jan 09 2023 %Y A358921 Cf. A133622, A268696, A329985. %K A358921 nonn,hear,look %O A358921 1,2 %A A358921 _Samuel Harkness_, Dec 06 2022