login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A364880
a(0) = 0. If a(n-1) is a novel term, a(n) = a(a(n-1)); otherwise a(n) is the number of distinct terms occurring prior to a(n-1) which are <= a(n-1).
1
0, 0, 1, 0, 1, 2, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5, 6, 7, 8, 9
OFFSET
0,6
COMMENTS
The novel terms are all records so the records subsequence is A000027.
Following each record term r, the sequence resets to a(r) then increments to novel term r+1, which introduces a(r+1), and so on (compare with A002262, which resets to 0 after each record).
The proper subsequence {a(a(r))} is a copy of the original, which therefore is fractal.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10353 (rows 0..150, flattened)
Michael De Vlieger, Scatterplot of a(n), n = 0..119 showing the first terms in each row in red, and all other terms in dark blue, labeling these respectively in the same color so as to demonstrate T(n,1) = a(n-1), where T(n,1) is the first term of row n, and sequence a represents the flattened irregular table T.
Michael De Vlieger, Scatterplot of a(n), n = 0..2047 with the same color approach used above, but only labeling T(n,1).
EXAMPLE
a(0) = 0 is a novel term, so a(1) = a(a(0)) = a(0) = 0.
a(2) = 1 because there is just one distinct prior term (0) which is <= 0.
Since a(2) = 1 is a novel term, a(3) = a(a(2)) = a(1) = a(0) = 0.
a(4) = 1 because a(3) = 0 is a repeat term and there is only one distinct term (0) <= 0.
The sequence can be represented as an irregular table in which each row starts with a record term, and ends with the first repeat of the same number. The first column is A000027, and the second column is the sequence itself:
The table starts:
0, 0;
1, 0, 1;
2, 1, 2;
3, 0, 1, 2, 3;
4, 1, 2, 3, 4;
5, 2, 3, 4, 5;
6, 1, 2, 3, 4, 5, 6;
7, 2, 3, 4, 5, 6, 7;
8, 3, 4, 5, 6, 7, 8;
9, 0, ...
MATHEMATICA
nn = 120; a[0] = j = k = 0; r = -1; Do[If[j > r, k = a[j]; r = j, k++]; Set[{a[n], j}, {k, k}], {n, nn}]; Array[a, nn + 1, 0] (* Michael De Vlieger, Aug 14 2023 *)
CROSSREFS
Sequence in context: A348910 A123590 A092872 * A141455 A292627 A113125
KEYWORD
nonn,easy,tabf
AUTHOR
STATUS
approved