OFFSET
1,2
LINKS
Carole Dubois, Table of n, a(n) for n = 1..5000
EXAMPLE
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.
PROG
(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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Feb 03 2020
STATUS
approved