OFFSET
1,2
COMMENTS
All terms > a(24) contain at least one 9 with an adjacent 0. All terms > a(25) contain at least one instance of identical adjacent digits.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
a(125) = 9902. The next term is 10097, not 20009, because, in spite of its providing more digit differences than are needed, it is lexicographically earlier.
PROG
(Python)
from itertools import count, islice
def c(k, d):
dk = list(map(int, str(k)))
return set(abs(dk[i+1]-dk[i]) for i in range(len(dk)-1)) >= d
def agen(): # generator of terms
an, aset = 0, {0}
while True:
yield an
d = set(map(int, set(str(an))))
an = next(k for k in count(10**len(d)) if k not in aset and c(k, d))
aset.add(an)
print(list(islice(agen(), 41))) # Michael S. Branicky, May 27 2023
def A362335(n, A=[0]):
while len(A) <= n:
z = lambda a: zip(d := tuple(int(d) for d in str(a)), d[1:])
D = set(str(A[-1])) ; a = 10**len(D)
while a in A or D - set(str(abs(x-y)) for x, y in z(a)): a += 1
A . append(a)
return A[n] # M. F. Hasler, May 27 2023
(PARI) {upto(N) = my(U=[], a=0); vector(N, n, if(n>1, my(da=Set(if(a, digits(a)))); a=10^#da; while( setsearch(U, a) || #setminus(da, Set(abs((n=digits(a))[^1]-n[^-1]))), a++)); U=setunion(U, [a]); a)} \\ M. F. Hasler, May 27 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and Hans Havermann, May 27 2023
EXTENSIONS
a(27) and beyond from Michael S. Branicky, May 27 2023
STATUS
approved