OFFSET
1,3
COMMENTS
As the digit 0 has no predecessor and the digit 9 has no successor here, sets of successive digits like {3,2,1,0,9} and {6,7,8,9,0} are forbidden.
LINKS
Dominic McCarty, Table of n, a(n) for n = 1..10000 (first 257 terms from Jean-Marc Falcoz)
EXAMPLE
Terms a(1) to a(10) are obvious;
a(11) is 56 because 56 is the smallest integer not yet in the sequence such that the elements of the sets {6,7,8,9,5} and {7,8,9,5,6} are five consecutive digits;
a(12) is 78 because 78 is the smallest integer not yet in the sequence such that the elements of the sets {8,9,5,6,7} and {9,5,6,7,8} are five consecutive digits;
a(13) is 45 because 45 is the smallest integer not yet in the sequence such that the elements of the sets {5,6,7,8,4} and {6,7,8,4,5} are five consecutive digits;
etc.
PROG
(Python)
a, runLength = [i for i in range(10)], 5
def helper(s, k, l, a):
if k not in a: return k
return min([helper(s[(2-l):]+str(i), int(str(k)+str(i)), l, a) for i in range(10) if (k!=0 or i!=0) and s.find(str(i))==-1 and (all(d[n]+1==d[n+1] for n in range(l-1)) if (d:=sorted([int((s+str(i))[n]) for n in range(l)])) else False)])
while len(a)<100: a.append(helper(("".join(map(str, a)))[(1-runLength):], 0, runLength, a))
print(a) # Dominic McCarty, Feb 03 2025
CROSSREFS
KEYWORD
nonn,base,changed
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Apr 09 2018
STATUS
approved