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.

A331975 Lexicographically earliest sequence of distinct positive integers such that three successive digits are always distinct.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 21, 30, 12, 31, 20, 13, 24, 15, 23, 14, 25, 16, 27, 18, 26, 17, 28, 19, 32, 40, 29, 34, 50, 35, 41, 36, 42, 37, 43, 51, 38, 45, 39, 46, 52, 47, 53, 48, 54, 60, 49, 56, 70, 57, 61, 58, 62, 59, 63, 71, 64, 72, 65, 73, 67, 80, 68, 74, 69, 75, 81, 76, 82, 78, 90, 79, 83, 91, 84
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 03 2020

Keywords

Examples

			As a(10) = 10, a(11) cannot start with a 1 or have a 0 in second position; thus a(11) = 21;
as a(11) = 21, a(12) cannot start with a 1 or a 2; thus a(12) = 30;
as a(12) = 30, a(13) = 12, smallest available integer not leading to an immediate contradiction;
as a(13) = 12, a(14) cannot start with 1 or 2; thus a(14) = 31, smallest available integer not leading to an immediate contradiction. Etc.
		

Crossrefs

Cf. A331215 (a variant with 4 successive distinct digits instead of 3).

Programs

  • Python
    from itertools import islice
    def ok(s): return all(len(set(s[i:i+3]))==3 for i in range(len(s)-2))
    def agen(): # generator of terms
        aset, s, k, mink = {1}, "x1", 1, 2
        while True:
            yield k
            k, avoid = mink, set(s)
            while k in aset or not ok(s + str(k)): k += 1
            aset.add(k)
            s = (s + str(k))[-3:]
            while mink in aset: mink += 1
    print(list(islice(agen(), 79))) # Michael S. Branicky, Jun 30 2022