OFFSET
1,2
LINKS
Éric Angelini, More Levenshtein distances, Personal blog, December 2023.
EXAMPLE
a(1) = 0 and a(2) = 11111 are separated by an Ld of 5
a(2) = 11111 and a(3) = 1 2 are separated by an Ld of 5
a(3) = 2 and a(4) = 10000 are separated by an Ld of 5
a(4) = 10000 and a(5) = 3 are separated by an Ld of 5, etc.
MATHEMATICA
a[1]=0; a[n_]:=a[n]=(k=1; While[MemberQ[Array[a, n-1], k]||EditDistance[ToString@a[n-1], ToString@k]!=5, k++]; k); Array[a, 57]
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)) != 5: k += 1
an = k
aset.add(k)
while mink in aset: mink += 1
print(list(islice(agen(), 57))) # Michael S. Branicky, Dec 01 2023
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Giorgos Kalogeropoulos, Dec 01 2023
STATUS
approved