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.

Original entry on oeis.org

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

Views

Author

Neal Gersh Tolunsky, Dec 06 2024

Keywords

Comments

Note that we are considering multisets between every pair of equal values, not just those that appear consecutively.
Each positive integer occurs infinitely many times.
A new value is always followed by 1.
First differs from A366493 at a(19).

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.
		

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