%I #13 Dec 21 2023 21:20:19
%S 0,11111,2,10000,3,10001,4,10002,5,10003,6,10004,7,10005,8,10006,9,
%T 10007,21,10008,22,10009,23,10010,24,10011,25,10012,26,10013,27,10014,
%U 28,10015,29,10016,32,10017,33,10018,34,10019,35,10020,31,10022,36,10021,37,10023,38,10024,39,10025,41,10026,43
%N Lexicographically earliest sequence of distinct nonnegative terms such that the Levenshtein distance (Ld) between a(n) and a(n+1) is equal to 5.
%H Éric Angelini, <a href="https://cinquantesignes.blogspot.com/2023/12/more-levenshtein-distances.html">More Levenshtein distances</a>, Personal blog, December 2023.
%e a(1) = 0 and a(2) = 11111 are separated by an Ld of 5
%e a(2) = 11111 and a(3) = 1 2 are separated by an Ld of 5
%e a(3) = 2 and a(4) = 10000 are separated by an Ld of 5
%e a(4) = 10000 and a(5) = 3 are separated by an Ld of 5, etc.
%t 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]
%o (Python)
%o from itertools import islice
%o from Levenshtein import distance as Ld
%o def agen(): # generator of terms
%o an, aset, mink = 0, {0}, 1
%o while True:
%o yield an
%o s, k = str(an), mink
%o while k in aset or Ld(s, str(k)) != 5: k += 1
%o an = k
%o aset.add(k)
%o while mink in aset: mink += 1
%o print(list(islice(agen(), 57))) # _Michael S. Branicky_, Dec 01 2023
%Y Cf. A118763, A367812, A367813, A367814.
%K base,nonn
%O 1,2
%A _Eric Angelini_ and _Giorgos Kalogeropoulos_, Dec 01 2023