A341846 a(1) = 0; thereafter, if a(n) has not appeared before, a(n+1) = number of existing terms which are greater than a(n); otherwise, a(n) = n-m where a(m) is the most recent copy of a(n).
0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 1, 4, 2, 7, 0, 6, 8, 0, 3, 6, 4, 9, 0, 5, 14, 0, 3, 8, 11, 1, 19, 0, 6, 13, 2, 22, 0, 5, 14, 14, 1, 11, 13, 9, 22, 9, 2, 12, 8, 21, 2, 4, 31, 0, 17, 5, 18, 5, 2, 8, 11, 19, 31, 10, 18, 8, 6, 34, 0, 15, 11, 10, 8, 7, 60, 0, 7
Offset: 1
Keywords
Examples
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.
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.
Crossrefs
Cf. A181391.
Programs
-
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 *)
-
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
Comments