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.

A330896 Lexicographically earliest sequence of positive integers such that for any m > 0, gaps between consecutive m's are all distinct.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 1, 3, 2, 3, 1, 4, 2, 3, 3, 1, 4, 2, 4, 3, 5, 1, 3, 2, 4, 4, 5, 5, 1, 3, 2, 5, 4, 5, 6, 3, 1, 6, 2, 6, 4, 5, 7, 3, 4, 1, 5, 2, 6, 5, 7, 7, 3, 4, 6, 1, 4, 2, 5, 6, 6, 7, 3, 7, 6, 5, 1, 4, 2, 7, 8, 6, 7, 3, 8, 5, 7, 4, 1, 6, 2, 7, 8, 8, 9, 3, 5
Offset: 1

Views

Author

Rémy Sigrist, May 01 2020

Keywords

Comments

Every positive integer appears infinitely many times in the sequence.
This sequence has similarities with A003602, where gaps between consecutive equal values are all distinct.
This sequence has similarities with A002260, where for any m > 0, gaps between consecutive m's are strictly increasing.
Apparently, for any m > 0:
- the k-th gap between consecutive m's equals k except for finitely many k's,
- the k-th occurrence of m appears at index A330897(m) + A000217(k-1) except for finitely many k's.

Examples

			The first terms, alongside the gaps for m = 1..4, are:
     n|  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  ...
  a(n)|  1  1  2  1  2  2  1  3  2  3  1  4  2  3  3  1  4  2  4  3  5  1  3  ...
  ----+---------------------------------------------------------------------
   1's|     1,    2,       3,          4,             5,                6,    ...
   2's|              2, 1,       3,          4,             5,                ...
   3's|                             2,          4, 1,             5,       3, ...
   4's|                                                  5,    2,             ...
		

Crossrefs

Programs

  • PARI
    \\ See Links section.
    
  • Python
    from itertools import islice
    def agen(): # generator of terms
        m, a = dict(), []
        while True:
            an, allnew = 0, False
            while not allnew:
                allnew, an, mn = True, an+1, set()
                for i in range(len(a)-1, -1, -1):
                    if an == a[i]:
                        t = len(a)-i+1
                        if (an in m and t in m[an]) or t in mn: allnew = False; break
                        mn.add(t)
                        break
            yield an; a.append(an)
            if an not in m: m[an] = set()
            m[an] |= mn
    print(list(islice(agen(), 87))) # Michael S. Branicky, Dec 06 2024

Formula

a(n) = 1 iff n belongs to A000124.