login
A342909
a(1)=1. Thereafter, if a(n) is a novel term a(n+1) = number of prior terms > a(n); otherwise a(n+1) = number of prior terms <= a(n).
1
1, 0, 1, 2, 0, 1, 4, 0, 2, 7, 0, 3, 2, 9, 0, 4, 13, 0, 5, 3, 13, 20, 0, 6, 5, 18, 1, 10, 4, 18, 28, 0, 7, 24, 1, 12, 7, 26, 1, 13, 33, 0, 8, 13, 36, 0, 9, 32, 2, 19, 7, 31, 3, 22, 7, 33, 54, 0
OFFSET
1,4
COMMENTS
The definition implies that the sequence is infinite, and a(n+1) < n for all n. Conjecture: Zero occurs infinitely many times.
LINKS
Michael De Vlieger, Scatterplot of a(n) for 1 <= n <= 2^16.
Michael De Vlieger, Scatterplot of a(n) for 1 <= n <= 2^16, with even n shown in red and odd n shown in blue.
EXAMPLE
a(1)=1, the first novel term. The number of prior terms > 1 is 0, so a(2)=0. a(3) = 1, because a(2) = 0 is a novel term and there is only one term (a(1)=1)>0. Since a(3) = 1 has been seen before a(4)= 2, the number of prior terms (1,0) which are <=1.
MATHEMATICA
Block[{a = {1}, k}, Do[k = a[[-1]]; AppendTo[a, If[FreeQ[Most@ a, k], Count[a, _?(# > k &)], -1 + Count[a, _?(# <= k &)]]], 57]; a] (* Michael De Vlieger, Mar 28 2021 *)
CROSSREFS
Sequence in context: A181670 A261251 A341101 * A081265 A039991 A273821
KEYWORD
nonn,look
AUTHOR
STATUS
approved