A330896 Lexicographically earliest sequence of positive integers such that for any m > 0, gaps between consecutive m's are all distinct.
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
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, ...
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Rémy Sigrist, PARI program for A330896
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.
Comments