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.

A331215 Lexicographically earliest sequence of distinct positive integers such that four successive digits are always distinct.

This page as a plain text file.
%I A331215 #33 Jul 01 2022 05:33:38
%S A331215 1,2,3,4,5,6,7,8,9,10,23,14,20,13,24,15,26,17,25,16,27,18,29,30,12,34,
%T A331215 19,28,31,40,21,35,41,32,45,36,42,37,46,38,47,39,48,50,43,51,49,52,60,
%U A331215 53,61,54,62,57,63,58,64,59,67,80,56,70,81,65,71,68,72,69,73,82,74,83,75,84,76,85,79,86,102
%N A331215 Lexicographically earliest sequence of distinct positive integers such that four successive digits are always distinct.
%C A331215 This is not A276766, though the first 63 terms are the same.
%H A331215 Carole Dubois, <a href="/A331215/b331215.txt">Table of n, a(n) for n = 1..5000</a>
%e A331215 The four digits of a(11) = 23 and a(12) = 14 are distinct;
%e A331215 the four digits of a(12) = 14 and a(13) = 20 are distinct;
%e A331215 but so are also the successive digits 3,1,4,2 visible in 23, 14, 20;
%e A331215 the four digits of a(13) = 20 and a(14) = 13 are distinct;
%e A331215 the four digits of a(14) = 13 and a(15) = 24 are distinct;
%e A331215 but so are also the successive digits 0,1,3,2 visible in 20,13,24; etc.
%o A331215 (Python)
%o A331215 from itertools import islice
%o A331215 def ok(s): return all(len(set(s[i:i+4]))==4 for i in range(len(s)-3))
%o A331215 def agen(): # generator of terms
%o A331215     aset, s, k, mink = {1}, "xy1", 1, 2
%o A331215     while True:
%o A331215         yield k
%o A331215         k, avoid = mink, set(s)
%o A331215         while k in aset or not ok(s + str(k)): k += 1
%o A331215         aset.add(k)
%o A331215         s = (s + str(k))[-4:]
%o A331215         while mink in aset: mink += 1
%o A331215 print(list(islice(agen(), 79))) # _Michael S. Branicky_, Jun 30 2022
%Y A331215 Cf. A331975 (a variant with 3 successive distinct digits instead of 4), A276766.
%K A331215 base,nonn
%O A331215 1,2
%A A331215 _Eric Angelini_ and _Carole Dubois_, Feb 03 2020