A366631 Lexicographically earliest sequence such that each set of numbers enclosed by a pair of equal terms, excluding the endpoints, is distinct.
1, 1, 2, 1, 2, 3, 2, 4, 2, 3, 4, 5, 3, 6, 3, 5, 6, 7, 3, 8, 4, 5, 7, 8, 7, 8, 9, 4, 7, 9, 10, 4, 9, 10, 11, 4, 10, 12, 4, 11, 13, 4, 12, 13, 12, 13, 14, 4, 15, 4, 14, 15, 16, 4, 17, 6, 8, 10, 14, 16, 17, 16, 17, 18, 9, 15, 17, 18, 19, 11, 16, 19, 20, 18, 19
Offset: 1
Keywords
Examples
a(2)=1, establishing the empty set, [1,1] -> {}. a(4)=1, creating the sets [1,2,1] -> {2} and [1,1,2,1] -> {1,2}, which are distinct from any set that has appeared thus far. Note that 1 is now permanently banned since the next 1 would have to enclose the same set with a(1) as it would with a(2). a(8)=4: a(8) cannot be 1 since 1 has been banned. 2 would form the empty set with a(7)=2. a(8) cannot be 3 since this would form the set [3,2,3] -> {2}, which already occurred as [1,2,1] -> {2}. a(8)=4 because 4 is a first occurrence and thus forms no sets. For another example of a banned number, see the last occurrence of 2, which is a(9)=2. a(10) cannot be 2 since this would form the empty set. At a(11), the value 2 is banned forever since any further 2 would form the same set of numbers with a(7)=2 as with a(5)=2. This is because a later term paired with a(5)=2 would only add the values a(7)=2 and a(6)=3, in comparison to a pairing with a(7)=2, which already encloses a(9)=2 and a(10)=3.
Links
- Neal Gersh Tolunsky, Table of n, a(n) for n = 1..10000
- Rémy Sigrist, PARI program
- Neal Gersh Tolunsky, First differences of 100000 terms
- Neal Gersh Tolunsky, Ordinal transform of 100000 terms
Programs
-
PARI
See Links section.
-
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(set(a[i+1:]))) 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(), 75))) # Michael S. Branicky, Jan 15 2024
Extensions
More terms from Rémy Sigrist, Oct 15 2023
Edited by Peter Munn, Dec 05 2023
Comments