# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a366631 Showing 1-1 of 1 %I A366631 #69 Jan 25 2024 16:39:06 %S A366631 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, %T A366631 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, %U A366631 14,16,17,16,17,18,9,15,17,18,19,11,16,19,20,18,19 %N A366631 Lexicographically earliest sequence such that each set of numbers enclosed by a pair of equal terms, excluding the endpoints, is distinct. %C A366631 The word 'set' means that every element is unique and order is irrelevant. {2,3}, for example, is equivalent to {3,2,2} and thus both could never appear in the sequence. %C A366631 Two consecutive equal values enclose the empty set {}, and thus after [a(1), a(2)] = [1, 1] no consecutive equal values will occur again. %C A366631 Note that we are considering sets between every pair of equal values, not just those that appear consecutively. For example, [2,1,2,3,2] encloses a set, which is {1,2,3}, as well as [2,3,2], which encloses {3}. %C A366631 It appears that for n >= 21510, a(n + 17796) = a(n) + 2614 (found by Rémy Sigrist). If this linear recurrence is true, every number appears finitely many times. %C A366631 A value k is banned after all the values in a set enclosed by a(i1) = a(i2) = k, with i1 < i2, and k itself have reoccurred in the sequence after a(i2). Suppose, for example, after the set S1 enclosed by a(i1) and a(i2) every element in S1 has appeared and also a(i3) = k, and then we had a(i4) = k. Then we would have a new set S2 enclosed by a(i2) and a(i4) that is a superset of S1 U {k}. This would contradict the sequence's definition since the set S2 enclosed by a(i2) and a(i4) is identical to the set S3 enclosed by a(i1) and a(i4) because S1 U {a(i2)} adds no new elements. %C A366631 Assuming the linear recurrence above is true, the number 526 occurs a record number of 44 times in the sequence and it does not occur again after the linear recurrence begins. The same is true of three other values which occur 41, 42, and 43 times in the sequence. %C A366631 For n > 2, a new value is always followed by the smallest number that has not yet been banned and is distinct from the previous number (i.e. does not form a null set). %C A366631 If the definition is changed so that endpoints are included, this becomes A008619. %H A366631 Neal Gersh Tolunsky, Table of n, a(n) for n = 1..10000 %H A366631 Rémy Sigrist, PARI program %H A366631 Neal Gersh Tolunsky, First differences of 100000 terms %H A366631 Neal Gersh Tolunsky, Ordinal transform of 100000 terms %e A366631 a(2)=1, establishing the empty set, [1,1] -> {}. %e A366631 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). %e A366631 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. %e A366631 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. %o A366631 (PARI) See Links section. %o A366631 (Python) %o A366631 from itertools import islice %o A366631 def agen(): # generator of terms %o A366631 m, a = set(), [] %o A366631 while True: %o A366631 an, allnew = 0, False %o A366631 while not allnew: %o A366631 allnew, an, mn = True, an+1, set() %o A366631 for i in range(len(a)): %o A366631 if an == a[i]: %o A366631 t = tuple(sorted(set(a[i+1:]))) %o A366631 if t in m or t in mn: allnew = False; break %o A366631 mn.add(t) %o A366631 yield an; a.append(an); m |= mn %o A366631 print(list(islice(agen(), 75))) # _Michael S. Branicky_, Jan 15 2024 %Y A366631 Cf. A158416, A366625, A366624, A366493, A366691, A369320. %K A366631 nonn %O A366631 1,3 %A A366631 _Neal Gersh Tolunsky_, Oct 14 2023 %E A366631 More terms from _Rémy Sigrist_, Oct 15 2023 %E A366631 Edited by _Peter Munn_, Dec 05 2023 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE