cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A367814 Lexicographically earliest sequence of distinct nonnegative terms such that the Levenshtein distance (Ld) between a(n) and a(n+1) is equal to 4.

This page as a plain text file.
%I A367814 #13 Dec 21 2023 15:18:50
%S A367814 0,1111,2,1000,3,1001,4,1002,5,1003,6,1004,7,1005,8,1006,9,1007,21,
%T A367814 1008,22,1009,23,1010,24,1011,25,1012,26,1013,27,1014,28,1015,29,1016,
%U A367814 32,1017,33,1018,34,1019,35,1020,31,1022,36,1021,37,1023,38,1024,39,1025,41,1026,43,1027,44,1028,45,1029,46,1030
%N A367814 Lexicographically earliest sequence of distinct nonnegative terms such that the Levenshtein distance (Ld) between a(n) and a(n+1) is equal to 4.
%H A367814 Éric Angelini, <a href="https://cinquantesignes.blogspot.com/2023/12/more-levenshtein-distances.html">More Levenshtein distances</a>, Personal blog, December 2023.
%e A367814 a(1) =    0 and a(2) = 1111 are separated by an Ld of 4
%e A367814 a(2) = 1111 and a(3) =    2 are separated by an Ld of 4
%e A367814 a(3) =    2 and a(4) = 1000 are separated by an Ld of 4
%e A367814 a(4) = 1000 and a(5) =    3 are separated by an Ld of 4, etc.
%t A367814 a[1]=0;a[n_]:=a[n]=(k=1;While[MemberQ[Array[a,n-1],k]||EditDistance[ToString@a[n-1],ToString@k]!=4,k++];k);Array[a,64]
%o A367814 (Python)
%o A367814 from itertools import islice
%o A367814 from Levenshtein import distance as Ld
%o A367814 def agen(): # generator of terms
%o A367814     an, aset, mink = 0, {0}, 1
%o A367814     while True:
%o A367814         yield an
%o A367814         s, k = str(an), mink
%o A367814         while k in aset or Ld(s, str(k)) != 4: k += 1
%o A367814         an = k
%o A367814         aset.add(k)
%o A367814         while mink in aset: mink += 1
%o A367814 print(list(islice(agen(), 64))) # _Michael S. Branicky_, Dec 01 2023
%Y A367814 Cf. A118763, A367812, A367813, A367815.
%K A367814 base,nonn
%O A367814 1,2
%A A367814 _Eric Angelini_ and _Giorgos Kalogeropoulos_, Dec 01 2023