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.

A366625 Lexicographically earliest sequence of positive integers such that each multiset enclosed by two equal terms, excluding the endpoints, is distinct.

This page as a plain text file.
%I A366625 #49 Jan 15 2024 18:45:04
%S A366625 1,1,2,1,2,3,1,2,4,1,2,3,2,1,5,1,2,3,4,1,2,3,4,2,1,5,3,1,2,4,2,1,5,3,
%T A366625 4,1,2,6,1,2,3,4,5,1,2,4,3,7,1,2,3,4,5,3,1,2,6,2,1,3,4,5,7,1,2,3,4,5,
%U A366625 6,1,2,3,4,7,2,1,3,4,5,6,1,2,4,3,5,8,1
%N A366625 Lexicographically earliest sequence of positive integers such that each multiset enclosed by two equal terms, excluding the endpoints, is distinct.
%C A366625 Every positive integer occurs infinitely many times in the sequence.
%C A366625 The multiset between any two equal terms is unique. For example: once consecutive values "A B C A" occur, both "D B C D" and "D C B D" can never occur, because the multiset "B C" would be repeated between equal terms.
%C A366625 Two consecutive values enclose the empty multiset. For this reason, after [a(1), a(2)] = [1, 1], no consecutive equal values will occur again.
%C A366625 A new value is always followed by 1.
%C A366625 The sequence first differs from A366624 at a(15).
%H A366625 Michael S. Branicky, <a href="/A366625/b366625.txt">Table of n, a(n) for n = 1..7522</a>
%H A366625 Samuel Harkness, <a href="/A366625/a366625.m.txt">MATLAB program</a>.
%H A366625 Neal Gersh Tolunsky, <a href="/A366625/a366625.png">Ordinal Transform of 5000 terms</a>.
%e A366625 a(15) = 5: a(15) cannot be 1 since this would form the empty multiset with a(14) = 1. a(15) cannot be 2 because this would form the multiset [2 1 2] = {1}, which already occurred at [2 1 2] = {1}. a(15) cannot be 3 because this would form the multiset [3 2 1 3] = {1, 2}, which already occurred at [1 1 2 1] = {1, 2}. a(15) cannot be 4 because this would form the multiset [4 1 2 3 2 1 4] = {1, 1, 2, 2, 3}, which already occurred at [1 1 2 1 2 3 1] = {1, 1, 2, 2, 3}. a(15) = 5 because 5 is a first occurrence and thus creates no new multisets.
%e A366625 For this sequence, the multisets between k and all other occurrences of k must be checked. The first instance such that this is the sole reason for restricting a possible value is when considering 2 for a(27).
%e A366625 a(27) != 2 since 2 there would cause two enclosed multisets with the same 5 terms (in different order, which doesn't matter for a multiset),
%e A366625   n    =   15      19    22      26 27
%e A366625   a(n) =  1 5 1 2 3 4 1 2 3 4 2 1 5 [2]
%e A366625             |-------|     |-------|
%e A366625 There are also instances where overlapping conflicting regions are the sole reason for restricting a possible value.
%e A366625 a(74) != 5 since 5 there would cause two enclosed multisets with the same 20 terms,
%e A366625   n    =  38                              54
%e A366625   a(n) = 2 6 1 2 3 4 5 1 2 4 3 7 1 2 3 4 5 3 1
%e A366625            |----------------------------------
%e A366625                                            |--
%e A366625   n    =  57                              73
%e A366625   a(n) = 2 6 2 1 3 4 5 7 1 2 3 4 5 6 1 2 3 4[5]
%e A366625          --|
%e A366625          ----------------------------------|
%o A366625 (MATLAB) See Links section.
%o A366625 (Python)
%o A366625 from itertools import islice
%o A366625 def agen(): # generator of terms
%o A366625     m, a = set(), []
%o A366625     while True:
%o A366625         an, allnew = 0, False
%o A366625         while not allnew:
%o A366625             allnew, an, mn = True, an+1, set()
%o A366625             for i in range(len(a)):
%o A366625                 if an == a[i]:
%o A366625                     t = tuple(sorted(a[i+1:]))
%o A366625                     if t in m or t in mn: allnew = False; break
%o A366625                     mn.add(t)
%o A366625         yield an; a.append(an); m |= mn
%o A366625 print(list(islice(agen(), 87))) # _Michael S. Branicky_, Oct 25 2023
%Y A366625 Cf. A366624, A366631, A366493, A330896.
%K A366625 nonn
%O A366625 1,3
%A A366625 _Samuel Harkness_, Oct 14 2023