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 A346175 #28 Jul 01 2025 23:01:35 %S A346175 0,0,1,0,2,1,1,2,1,3,0,3,1,4,2,2,3,2,4,1,5,1,6,1,7,2,5,1,8,1,9,3,3,4, %T A346175 2,6,1,10,0,4,3,5,2,7,1,11,3,6,2,8,1,12,1,13,4,4,5,3,7,2,9,1,14,2,10, %U A346175 1,15,2,11,1,16,3,8,2,12,1,17,2,13,1,18,4,6 %N A346175 a(0)=0. If a(n) is a novel term, a(n+1)=a(a(n)). If a(n) has appeared before, a(n+1)=number of prior terms equal to a(n). %C A346175 This sequence is possible only with offset i=0 or 1, and a(i)=i. This is the i=0 version; variant i=1, beginning 1,1,1,2,1,3,1,4,2,1,... has similar properties. %C A346175 Let conditions 0 and 1 respectively pertain to novel a(n) and extant a(n) respectively. When a(n) is novel, condition 0 gives a(n+1)=a(a(n)), a number which by definition is already extant. If a(n) has appeared k (>1) times already then by condition 1, a(n+1)=k-1. Following novel term N, a chain of repeat terms is generated by consecutive applications of condition 1, until reaching novel term N+1, whereupon a(N+1) initiates the next run of familiar terms. A novel term begets repeats of extant terms until these in turn produce another novel term, and so on; the sequence is infinite. No consecutive novel terms can be adjacent, there is at least one extant term between them, namely a(N)=1 gives N,1,N+1. The subsequence of records is the nonnegative integers appearing in order. Every number appears once, and thereafter arises infinitely many times. %C A346175 a(m)=1 is the most frequently occurring term (arising both when a(m) is novel, with a(a(m))=1, and also as a(k+1) when a(k) is the second occurrence of m). The least occurring term is a(m)=0, which arises with increasing rarity as the sequence develops; namely at m= 0, 1, 2, 3, 10, 38, 225, 3635, 257942, ... %C A346175 The subsequence {a(m+1): a(m) = record; 0,1,2,3,4,...} is identical to the original, so this sequence properly contains infinitely many copies of itself. %C A346175 If condition 1 is replaced by the "count-back" rule of the Van Eck sequence (A181391), the result is A025480. %C A346175 The plot of this sequence looks like sailboats on a lake; see links for details. %H A346175 Michael De Vlieger, <a href="/A346175/b346175.txt">Table of n, a(n) for n = 0..10000</a> %H A346175 Michael De Vlieger, <a href="/A346175/a346175.png">Scatterplot of 2^18 terms</a> showing "sailboat" shaped voids. The voids have 2 observed varieties, i.e., with 2 or 3 initial cusps. %H A346175 Michael De Vlieger, <a href="/A346175/a346175_1.png">Scatterplot of 2^10 terms</a> showing partition of the sequence into subsequences by records (gray gridlines) and "supersequences" by the duplication of a term (labeled). %H A346175 Michael De Vlieger, <a href="/A346175/a346175_2.png">Enlarged scatterplot of a(1415..1651)</a> between the records 123 and 138 which repeats the term 18 (i.e., supersequence 18 which includes subsequences 123..137.) This is a "sailboat" shape with 2 initial cusps. %H A346175 Michael De Vlieger, <a href="/A346175/a346175_3.png">Enlarged scatterplot of a(1651..1898)</a> between the records 138 and 151 which repeats the term 19 (i.e., supersequence 19 which includes subsequences 138..150.) This is a "sailboat" shape with 3 initial cusps. %e A346175 a(0)=0 is a novel term so a(1)=a(a(0))=a(0)=0. %e A346175 a(2)=1 because 0 has occurred twice. %e A346175 Now a(2) is novel so a(3)=a(a(2))=a(1)=0, and so on. %t A346175 Block[{a, c, j, k, r, nn}, nn = 120; c[_] := 0; a[0] = r = j = 0; %t A346175 Do[If[a[n - 1] > r, %t A346175 r = a[n - 1]; k = a[a[n - 1]], %t A346175 k = c[a[n - 1]] ]; %t A346175 c[a[n - 1]]++; %t A346175 Set[{a[n], j}, {k, k}], {n, nn}]; %t A346175 Array[a, nn, 0] ] (* _Michael De Vlieger_, May 25 2025 *) %o A346175 (Python) %o A346175 from itertools import islice %o A346175 from collections import Counter %o A346175 def agen(): # generator of terms %o A346175 an, c, r, alst = 0, Counter(), -1, [] %o A346175 while True: %o A346175 yield an %o A346175 c[an] += 1 %o A346175 alst.append(an) %o A346175 if an > r: %o A346175 an, r = alst[an], an %o A346175 else: %o A346175 an = c[an] - 1 %o A346175 print(list(islice(agen(), 83))) # _Michael S. Branicky_, May 25 2025 %Y A346175 Cf. A025480, A181391. %K A346175 nonn,look %O A346175 0,5 %A A346175 _David James Sycamore_ and _Michael De Vlieger_, Jul 08 2021