login
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).
3
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,5
COMMENTS
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.
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.
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, ...
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.
If condition 1 is replaced by the "count-back" rule of the Van Eck sequence (A181391), the result is A025480.
The plot of this sequence looks like sailboats on a lake; see links for details.
LINKS
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.
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
Sequence in context: A327812 A319093 A228726 * A165357 A346741 A358105
KEYWORD
nonn,look
AUTHOR
STATUS
approved