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.

A378776 Lexicographically earliest sequence of positive integers such that each multiset enclosed by a pair of equal terms, including the endpoints, is distinct.

This page as a plain text file.
%I A378776 #17 Dec 14 2024 20:38:47
%S A378776 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,
%T A378776 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,
%U A378776 4,6,1,2,3,4,5,1,2,3,5,2,1,4,5,2,1,4,6,1
%N A378776 Lexicographically earliest sequence of positive integers such that each multiset enclosed by a pair of equal terms, including the endpoints, is distinct.
%C A378776 Note that we are considering multisets between every pair of equal values, not just those that appear consecutively.
%C A378776 Each positive integer occurs infinitely many times.
%C A378776 A new value is always followed by 1.
%C A378776 First differs from A366493 at a(19).
%H A378776 Neal Gersh Tolunsky, <a href="/A378776/b378776.txt">Table of n, a(n) for n = 1..7522</a>
%H A378776 Neal Gersh Tolunsky, <a href="/A378776/a378776.png">Ordinal transform of 7522 terms</a>
%e A378776 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.
%o A378776 (Python)
%o A378776 from itertools import islice
%o A378776 def agen(): # generator of terms
%o A378776     m, a = set(), []
%o A378776     while True:
%o A378776         an, allnew = 0, False
%o A378776         while not allnew:
%o A378776             allnew, an, mn = True, an+1, set()
%o A378776             for i in range(len(a)):
%o A378776                 if an == a[i]:
%o A378776                     t = tuple(sorted(a[i:]+[an]))
%o A378776                     if t in m or t in mn: allnew = False; break
%o A378776                     mn.add(t)
%o A378776         yield an; a.append(an); m |= mn
%o A378776 print(list(islice(agen(), 88))) # _Michael S. Branicky_, Dec 06 2024
%Y A378776 Cf. A366625.
%K A378776 nonn
%O A378776 1,3
%A A378776 _Neal Gersh Tolunsky_, Dec 06 2024