login
A343887
a(1) = 1. Thereafter if a(n) is a novel term, a(n+1) = number of prior terms > a(n). If a(n) has been seen already, a(n+1) = a(n) + smallest prior term (which, once used, cannot be used again).
3
1, 0, 1, 1, 2, 0, 1, 1, 2, 3, 0, 1, 1, 2, 3, 5, 0, 2, 2, 4, 1, 3, 4, 6, 0, 3, 3, 6, 9, 0, 3, 3, 6, 9, 12, 0, 4, 4, 8, 3, 7, 4, 7, 11, 1, 5, 6, 11, 16, 0, 6, 6, 12, 18, 0, 6, 6, 12, 18, 24, 0, 6, 6, 12, 18, 25, 0, 7, 7, 14, 6, 13, 7, 13, 20, 2, 10, 16, 18, 27, 0
OFFSET
1,5
COMMENTS
The sequence is nontrivial if and only if a(1) > 0. a(n) <= n for n <= 10000, but it is not known if this holds for all n. a(n) + a(n+1) <= n is usually but not always true (first exception is at n=509; a(509) + a(510) = 248 + 311 = 559).
For n > 1, a(n) = 0 if and only if a(n-1) is a record novel term, whereas every non-record novel term is followed by a nonzero term. Let S(n) be the set of unused terms prior to a(n), then step function |S(n)| increments +1 at a(k+1), where a(k) is a novel term. S(n) typically contains multiple copies of each unused number, providing a continuously incremented supply of least prior terms to add to repeat leading terms as the sequence extends. This suggests that there is always a next record, and hence that zero occurs infinitely many times. Indices of records: 1, 5, 10, 16, 24, 29, 35, 49, 54, 60, 66, 80, 86, 114, 136, 166, 176, 192, 198, 231, ...
If a(k) is a record term, we see a(k), 0, m, m, ... where m is the least member of S(k). Between any consecutive pair of zeros we see either no novel terms, in which case the trajectory climbs quickly to the next record term, or there are novel terms, each of which disturbs and extends the trajectory to the next record (see plots).
LINKS
Michael De Vlieger, Scatterplot of a(n) for n = 1..2^18.
Michael De Vlieger, Labeled scatterplot of a(n) for n = 1..2^9 showing records in red, zeros in blue, repeated terms in black, terms instigated by a new previous term in gold, and green otherwise.
EXAMPLE
a(2)=0 since a(1)=1 is a novel term and there are zero terms prior to a(1) which are greater than 1. a(3)=1 since a(2)=0 is a novel term and there is one prior term (a(1)=1) which is > 0. a(4)=1+0=1 because a(3) is a repeat term and the smallest unused prior term is 0.
MATHEMATICA
Block[{a = {1}, s = {}}, Do[If[FreeQ[#2, #1], AppendTo[a, Count[#2, _?(# > a[[-1]] &)] ], AppendTo[a, a[[-1]] + First[s] ]; Set[s, Rest@ s]] & @@ {First[#1], #2} & @@ TakeDrop[a, -1]; Set[s, Insert[s, a[[-2]], LengthWhile[s, # < a[[-2]] &] + 1]], 80]; a] (* Michael De Vlieger, May 03 2021 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
STATUS
approved