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.

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

This page as a plain text file.
%I A367815 #13 Dec 21 2023 21:20:19
%S A367815 0,11111,2,10000,3,10001,4,10002,5,10003,6,10004,7,10005,8,10006,9,
%T A367815 10007,21,10008,22,10009,23,10010,24,10011,25,10012,26,10013,27,10014,
%U A367815 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 A367815 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 A367815 Éric Angelini, <a href="https://cinquantesignes.blogspot.com/2023/12/more-levenshtein-distances.html">More Levenshtein distances</a>, Personal blog, December 2023.
%e A367815 a(1) =     0 and a(2) = 11111 are separated by an Ld of 5
%e A367815 a(2) = 11111 and a(3) = 1   2 are separated by an Ld of 5
%e A367815 a(3) =     2 and a(4) = 10000 are separated by an Ld of 5
%e A367815 a(4) = 10000 and a(5) =     3 are separated by an Ld of 5, etc.
%t A367815 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 A367815 (Python)
%o A367815 from itertools import islice
%o A367815 from Levenshtein import distance as Ld
%o A367815 def agen(): # generator of terms
%o A367815     an, aset, mink = 0, {0}, 1
%o A367815     while True:
%o A367815         yield an
%o A367815         s, k = str(an), mink
%o A367815         while k in aset or Ld(s, str(k)) != 5: k += 1
%o A367815         an = k
%o A367815         aset.add(k)
%o A367815         while mink in aset: mink += 1
%o A367815 print(list(islice(agen(), 57))) # _Michael S. Branicky_, Dec 01 2023
%Y A367815 Cf. A118763, A367812, A367813, A367814.
%K A367815 base,nonn
%O A367815 1,2
%A A367815 _Eric Angelini_ and _Giorgos Kalogeropoulos_, Dec 01 2023