A331215 Lexicographically earliest sequence of distinct positive integers such that four successive digits are always distinct.
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, 19, 28, 31, 40, 21, 35, 41, 32, 45, 36, 42, 37, 46, 38, 47, 39, 48, 50, 43, 51, 49, 52, 60, 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
Offset: 1
Examples
The four digits of a(11) = 23 and a(12) = 14 are distinct; the four digits of a(12) = 14 and a(13) = 20 are distinct; but so are also the successive digits 3,1,4,2 visible in 23, 14, 20; the four digits of a(13) = 20 and a(14) = 13 are distinct; the four digits of a(14) = 13 and a(15) = 24 are distinct; but so are also the successive digits 0,1,3,2 visible in 20,13,24; etc.
Links
- Carole Dubois, Table of n, a(n) for n = 1..5000
Programs
-
Python
from itertools import islice def ok(s): return all(len(set(s[i:i+4]))==4 for i in range(len(s)-3)) def agen(): # generator of terms aset, s, k, mink = {1}, "xy1", 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))[-4:] while mink in aset: mink += 1 print(list(islice(agen(), 79))) # Michael S. Branicky, Jun 30 2022
Comments