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.

A309890 Lexicographically earliest sequence of positive integers without triples in weakly increasing arithmetic progression.

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 2, 4, 4, 1, 1, 2, 1, 1, 2, 2, 4, 4, 2, 4, 4, 5, 5, 8, 5, 5, 9, 1, 1, 2, 1, 1, 2, 2, 4, 4, 1, 1, 2, 1, 1, 2, 2, 4, 4, 2, 4, 4, 5, 5, 8, 5, 5, 9, 2, 4, 4, 5, 5, 10, 5, 5, 10, 10, 11, 13, 10, 11, 10, 11, 13, 10, 10, 12, 13, 10, 13, 11, 12, 20, 11, 1, 1, 2, 1, 1, 2, 2, 4, 4, 1, 1, 2, 1, 1, 2, 2, 4, 4, 2
Offset: 1

Views

Author

Sébastien Palcoux, Aug 21 2019

Keywords

Comments

Formal definition: lexicographically earliest sequence of positive integers a(n) such that for any i > 0, there is no n > 0 such that 2a(n+i) = a(n) + a(n+2i) AND a(n) <= a(n+i) <= a(n+2i).
Sequence suggested by Richard Stanley as a variant of A229037. They differ from the 55th term. The numbers n for which a(n) = 1 are given by A003278, or equally by A005836 (Richard Stanley).
The sequence defined by c(n) = 1 if a(n) = 1 and otherwise c(n) = 0 is A039966 (although with a different offset). - N. J. A. Sloane, Dec 01 2019
Pleasant to listen to (button above) with Instrument no. 13: Marimba (and for better listening, save and convert to MP3).

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A309890_gen(): # generator of terms
        blist = []
        for n in count(0):
            i, j, b = 1, 1, set()
            while n-(i<<1) >= 0:
                x, y = blist[n-2*i], blist[n-i]
                z = (y<<1)-x
                if x<=y<=z:
                    b.add(z)
                    while j in b:
                        j += 1
                i += 1
            blist.append(j)
            yield j
    A309890_list = list(islice(A309890_gen(),30)) # Chai Wah Wu, Sep 12 2023
  • SageMath
    # %attach SAGE/ThreeFree.spyx
    from sage.all import *
    cpdef ThreeFree(int n):
         cdef int i,j,k,s,Li,Lj
         cdef list L,Lb
         cdef set b
         L=[1,1]
         for k in range(2,n):
              b=set()
              for i in range(k):
                   if 2*((i+k)/2)==i+k:
                        j=(i+k)/2
                        Li,Lj=L[i],L[j]
                        s=2*Lj-Li
                        if s>0 and Li<=Lj:
                             b.add(s)
              if 1 not in b:
                   L.append(1)
              else:
                   Lb=list(b)
                   Lb.sort()
                   for t in Lb:
                        if t+1 not in b:
                             L.append(t+1)
                             break
         return L