OFFSET
1,5
COMMENTS
The sequence is nontrivial only with a(1) = 0 or 1. a(1)=0 here for contrast with the Van Eck sequence A181391, with which data agrees up to a(12). 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 term > 0. Definition implies a(n) < n for all n. Open questions: Is it true that a(n) + a(n+1) < n for all n? (This is true for n <= 65000.) Do records ever arise from rule 1? Does every number appear? (If so, 0 appears infinitely many times.)
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10001
Michael De Vlieger, Scatterplot of a(n) for 1 <= n <= 4096, color coded to show records in red, zeros in blue, terms instigated by novel a(n) in green, and records in the last-mentioned terms in orange. The least unused number is indicated by a yellow step function line.
Michael De Vlieger, Plot of b(n) = a(n) + a(n+1) for 1 <= n <= 65536 showing a partial bifurcation resulting from conditions involving novel a(n+1) such that, for such conditions, b(n) > n/Pi.
Michael De Vlieger, Logarithmic scatterplot of a(n) for 1 <= n <= 65536.
EXAMPLE
a(2)=0 because a(1)=0 is a novel term, and there are 0 terms > 0.
a(3)=1 because a(2) has been seen before at a(1), and 2-1=1.
a(13)=1, because a(12)=5, a novel term with 1 earlier term (a(10)=6) greater than it.
MATHEMATICA
Block[{nn = 120, a = {0}, c}, Do[If[IntegerQ@ c[#], AppendTo[a, i - c[#] ]; Set[c[#], i], Set[c[#], i]; AppendTo[a, Count[Most@ a, _?(# > a[[-1]] &)]]] &[ a[[-1]] ], {i, nn}]; a] (* Michael De Vlieger, Feb 21 2021 *)
PROG
(Python)
def aupton(terms):
alst, an = [], 0
for n in range(1, terms+1):
if an not in alst: anp1 = sum(ai > an for ai in alst)
else: anp1 = alst[::-1].index(an) + 1
alst, an = alst + [an], anp1
return alst
print(aupton(79)) # Michael S. Branicky, Feb 21 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Feb 19 2021
STATUS
approved