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).
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, 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, 1, 15, 2, 11, 1, 16, 3, 8, 2, 12, 1, 17, 2, 13, 1, 18, 4, 6
Offset: 0
Examples
a(0)=0 is a novel term so a(1)=a(a(0))=a(0)=0. a(2)=1 because 0 has occurred twice. Now a(2) is novel so a(3)=a(a(2))=a(1)=0, and so on.
Links
- Michael De Vlieger, Table of n, a(n) for n = 0..10000
- Michael De Vlieger, Scatterplot of 2^18 terms showing "sailboat" shaped voids. The voids have 2 observed varieties, i.e., with 2 or 3 initial cusps.
- Michael De Vlieger, Scatterplot of 2^10 terms showing partition of the sequence into subsequences by records (gray gridlines) and "supersequences" by the duplication of a term (labeled).
- Michael De Vlieger, Enlarged scatterplot of a(1415..1651) 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.
- Michael De Vlieger, Enlarged scatterplot of a(1651..1898) 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.
Programs
-
Mathematica
Block[{a, c, j, k, r, nn}, nn = 120; c[_] := 0; a[0] = r = j = 0; Do[If[a[n - 1] > r, r = a[n - 1]; k = a[a[n - 1]], k = c[a[n - 1]] ]; c[a[n - 1]]++; Set[{a[n], j}, {k, k}], {n, nn}]; Array[a, nn, 0] ] (* Michael De Vlieger, May 25 2025 *)
-
Python
from itertools import islice from collections import Counter def agen(): # generator of terms an, c, r, alst = 0, Counter(), -1, [] while True: yield an c[an] += 1 alst.append(an) if an > r: an, r = alst[an], an else: an = c[an] - 1 print(list(islice(agen(), 83))) # Michael S. Branicky, May 25 2025
Comments