OFFSET
0,3
COMMENTS
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 0..10000
Michael Gilleland, Levenshtein Distance
MATHEMATICA
levenshtein[s_List, t_List] := Module[{d, n = Length@ s, m = Length@ t}, Which[s === t, 0, n == 0, m, m == 0, n, s != t, d = Table[0, {m + 1}, {n + 1}]; d[[1, Range[n + 1]]] = Range[0, n]; d[[Range[m + 1], 1]] = Range[0, m]; Do[ d[[j + 1, i + 1]] = Min[d[[j, i + 1]] + 1, d[[j + 1, i]] + 1, d[[j, i]] + If[ s[[i]] === t[[j]], 0, 1]], {j, m}, {i, n}]; d[[ -1, -1]] ]]; f[lst_] := Block[{k = 1, l = IntegerDigits[ lst[[-1]]]}, While[ MemberQ[lst, k] || levenshtein[l, IntegerDigits[k]] > 1, k++]; Append[lst, k]]; Nest[f, {0}, 100] (* Robert G. Wilson v, Sep 22 2016 *)
PROG
(Python)
from itertools import islice
from Levenshtein import distance as Ld
def agen(): # generator of terms
an, aset, mink = 0, {0}, 1
while True:
yield an
s, k = str(an), mink
while k in aset or Ld(s, str(k)) != 1: k += 1
an = k
aset.add(k)
while mink in aset: mink += 1
print(list(islice(agen(), 73))) # Michael S. Branicky, Dec 01 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, May 01 2006
STATUS
approved