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, 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.
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 = {0}, c}, Do[If[IntegerQ@ c[#], AppendTo[a, c[#]]; c[#]++, AppendTo[a, a[[# + 1]]]; Set[c[#], 1]] &@ a[[-1]], 82]; a] (* Michael De Vlieger, Jul 13 2021 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
David James Sycamore and Michael De Vlieger, Jul 08 2021
STATUS
approved