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.

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

This page as a plain text file.
%I A367813 #11 Dec 21 2023 15:17:10
%S A367813 0,111,2,100,3,101,4,102,5,103,6,104,7,105,8,106,9,107,21,108,22,109,
%T A367813 23,110,24,112,20,113,25,114,26,115,27,116,28,117,29,118,30,119,32,
%U A367813 140,31,120,33,121,34,122,35,123,36,124,37,125,38,126,39,127,40,128,41,129,43,150,42,130,44,131,45,132,46,133
%N A367813 Lexicographically earliest sequence of distinct nonnegative terms such that the Levenshtein distance (Ld) between a(n) and a(n+1) is equal to 3.
%H A367813 Éric Angelini, <a href="https://cinquantesignes.blogspot.com/2023/12/more-levenshtein-distances.html">More Levenshtein distances</a>, Personal blog, December 2023.
%e A367813 a(1) =   0 and a(2) = 111 are separated by a Ld of 3
%e A367813 a(2) = 111 and a(3) =   2 are separated by a Ld of 3
%e A367813 a(3) =   2 and a(4) = 100 are separated by a Ld of 3
%e A367813 a(4) = 100 and a(5) =   3 are separated by a Ld of 3, etc.
%t A367813 a[1]=0;a[n_]:=a[n]=(k=1;While[MemberQ[Array[a,n-1],k]||EditDistance[ToString@a[n-1],ToString@k]!=3,k++];k);Array[a,72]
%o A367813 (Python)
%o A367813 from itertools import islice
%o A367813 from Levenshtein import distance as Ld
%o A367813 def agen(): # generator of terms
%o A367813     an, aset, mink = 0, {0}, 1
%o A367813     while True:
%o A367813         yield an
%o A367813         s, k = str(an), mink
%o A367813         while k in aset or Ld(s, str(k)) != 3: k += 1
%o A367813         an = k
%o A367813         aset.add(k)
%o A367813         while mink in aset: mink += 1
%o A367813 print(list(islice(agen(), 72))) # _Michael S. Branicky_, Dec 01 2023
%Y A367813 Cf. A118763, A367812, A367814, A367815.
%K A367813 base,nonn
%O A367813 1,2
%A A367813 _Eric Angelini_ and _Giorgos Kalogeropoulos_, Dec 01 2023