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.

This page as a plain text file.
%I A330896 #22 Dec 07 2024 02:03:00
%S A330896 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,
%T A330896 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,
%U A330896 2,7,8,6,7,3,8,5,7,4,1,6,2,7,8,8,9,3,5
%N A330896 Lexicographically earliest sequence of positive integers such that for any m > 0, gaps between consecutive m's are all distinct.
%C A330896 Every positive integer appears infinitely many times in the sequence.
%C A330896 This sequence has similarities with A003602, where gaps between consecutive equal values are all distinct.
%C A330896 This sequence has similarities with A002260, where for any m > 0, gaps between consecutive m's are strictly increasing.
%C A330896 Apparently, for any m > 0:
%C A330896 - the k-th gap between consecutive m's equals k except for finitely many k's,
%C A330896 - the k-th occurrence of m appears at index A330897(m) + A000217(k-1) except for finitely many k's.
%H A330896 Rémy Sigrist, <a href="/A330896/b330896.txt">Table of n, a(n) for n = 1..10000</a>
%H A330896 Rémy Sigrist, <a href="/A330896/a330896.gp.txt">PARI program for A330896</a>
%F A330896 a(n) = 1 iff n belongs to A000124.
%e A330896 The first terms, alongside the gaps for m = 1..4, are:
%e A330896      n|  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  ...
%e A330896   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  ...
%e A330896   ----+---------------------------------------------------------------------
%e A330896    1's|     1,    2,       3,          4,             5,                6,    ...
%e A330896    2's|              2, 1,       3,          4,             5,                ...
%e A330896    3's|                             2,          4, 1,             5,       3, ...
%e A330896    4's|                                                  5,    2,             ...
%o A330896 (PARI) \\ See Links section.
%o A330896 (Python)
%o A330896 from itertools import islice
%o A330896 def agen(): # generator of terms
%o A330896     m, a = dict(), []
%o A330896     while True:
%o A330896         an, allnew = 0, False
%o A330896         while not allnew:
%o A330896             allnew, an, mn = True, an+1, set()
%o A330896             for i in range(len(a)-1, -1, -1):
%o A330896                 if an == a[i]:
%o A330896                     t = len(a)-i+1
%o A330896                     if (an in m and t in m[an]) or t in mn: allnew = False; break
%o A330896                     mn.add(t)
%o A330896                     break
%o A330896         yield an; a.append(an)
%o A330896         if an not in m: m[an] = set()
%o A330896         m[an] |= mn
%o A330896 print(list(islice(agen(), 87))) # _Michael S. Branicky_, Dec 06 2024
%Y A330896 Cf. A000124, A000217, A002260, A003602, A330897.
%K A330896 nonn,look
%O A330896 1,3
%A A330896 _Rémy Sigrist_, May 01 2020