Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A331215 Lexicographically earliest sequence of distinct positive integers such that four successive digits are always distinct. 3

%I #33 Jul 01 2022 05:33:38

%S 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 19,28,31,40,21,35,41,32,45,36,42,37,46,38,47,39,48,50,43,51,49,52,60,

%U 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 Lexicographically earliest sequence of distinct positive integers such that four successive digits are always distinct.

%C This is not A276766, though the first 63 terms are the same.

%H Carole Dubois, <a href="/A331215/b331215.txt">Table of n, a(n) for n = 1..5000</a>

%e The four digits of a(11) = 23 and a(12) = 14 are distinct;

%e the four digits of a(12) = 14 and a(13) = 20 are distinct;

%e but so are also the successive digits 3,1,4,2 visible in 23, 14, 20;

%e the four digits of a(13) = 20 and a(14) = 13 are distinct;

%e the four digits of a(14) = 13 and a(15) = 24 are distinct;

%e but so are also the successive digits 0,1,3,2 visible in 20,13,24; etc.

%o (Python)

%o from itertools import islice

%o def ok(s): return all(len(set(s[i:i+4]))==4 for i in range(len(s)-3))

%o def agen(): # generator of terms

%o aset, s, k, mink = {1}, "xy1", 1, 2

%o while True:

%o yield k

%o k, avoid = mink, set(s)

%o while k in aset or not ok(s + str(k)): k += 1

%o aset.add(k)

%o s = (s + str(k))[-4:]

%o while mink in aset: mink += 1

%o print(list(islice(agen(), 79))) # _Michael S. Branicky_, Jun 30 2022

%Y Cf. A331975 (a variant with 3 successive distinct digits instead of 4), A276766.

%K base,nonn

%O 1,2

%A _Eric Angelini_ and _Carole Dubois_, Feb 03 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 12 09:47 EDT 2024. Contains 375850 sequences. (Running on oeis4.)