A378776 Lexicographically earliest sequence of positive integers such that each multiset enclosed by a pair of equal terms, including the endpoints, is distinct.
1, 1, 2, 1, 2, 2, 1, 3, 1, 2, 3, 1, 2, 4, 1, 2, 3, 2, 3, 1, 3, 2, 4, 2, 1, 3, 3, 4, 1, 3, 4, 1, 4, 1, 2, 3, 4, 1, 2, 4, 4, 1, 2, 5, 1, 2, 3, 4, 2, 3, 4, 1, 5, 1, 2, 3, 4, 3, 1, 5, 2, 3, 1, 4, 5, 1, 3, 2, 4, 6, 1, 2, 3, 4, 5, 1, 2, 3, 5, 2, 1, 4, 5, 2, 1, 4, 6, 1
Offset: 1
Keywords
Examples
a(19) = 3: a(19) cannot be 1 because then a(15..19) = (1, 2, 3, 2, 1) would be the same multiset as a(6..10) = (2, 1, 3, 1, 2). a(19) cannot be 2 since this would make a(18-19) = (2,2), which is the same multiset as a(5-6). a(19) can be 3 since this does not create any repeat multiset.
Links
- Neal Gersh Tolunsky, Table of n, a(n) for n = 1..7522
- Neal Gersh Tolunsky, Ordinal transform of 7522 terms
Crossrefs
Cf. A366625.
Programs
-
Python
from itertools import islice def agen(): # generator of terms m, a = set(), [] while True: an, allnew = 0, False while not allnew: allnew, an, mn = True, an+1, set() for i in range(len(a)): if an == a[i]: t = tuple(sorted(a[i:]+[an])) if t in m or t in mn: allnew = False; break mn.add(t) yield an; a.append(an); m |= mn print(list(islice(agen(), 88))) # Michael S. Branicky, Dec 06 2024
Comments