cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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).

Original entry on oeis.org

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

Views

Author

David James Sycamore, Feb 19 2021

Keywords

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.)

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.
		

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