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.

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

This page as a plain text file.
%I A367812 #13 Dec 21 2023 15:17:00
%S A367812 0,11,2,10,3,12,4,13,5,14,6,15,7,16,8,17,9,18,20,1,22,19,21,30,23,31,
%T A367812 24,32,25,33,26,34,27,35,28,36,29,37,40,38,41,39,42,50,43,51,44,52,45,
%U A367812 53,46,54,47,55,48,56,49,57,60,58,61,59,62,70,63,71,64,72,65,73,66,74,67,75,68,76,69,77,80,78
%N A367812 Lexicographically earliest sequence of distinct nonnegative terms such that the Levenshtein distance (Ld) between a(n) and a(n+1) is equal to 2.
%H A367812 Éric Angelini, <a href="https://cinquantesignes.blogspot.com/2023/12/more-levenshtein-distances.html">More Levenshtein distances</a>, Personal blog, December 2023.
%e A367812 a(1) =  0 and a(2) = 11 are separated by an Ld of 2
%e A367812 a(2) = 11 and a(3) =  2 are separated by an Ld of 2
%e A367812 a(3) =  2 and a(4) = 10 are separated by an Ld of 2
%e A367812 a(4) = 10 and a(5) =  3 are separated by an Ld of 2, etc.
%t A367812 a[1]=0;a[n_]:=a[n]=(k=1;While[MemberQ[Array[a,n-1],k]||EditDistance[ToString@a[n-1],ToString@k]!=2,k++];k);Array[a,80]
%o A367812 (Python)
%o A367812 from itertools import islice
%o A367812 from Levenshtein import distance as Ld
%o A367812 def agen(): # generator of terms
%o A367812     an, aset, mink = 0, {0}, 1
%o A367812     while True:
%o A367812         yield an
%o A367812         s, k = str(an), mink
%o A367812         while k in aset or Ld(s, str(k)) != 2: k += 1
%o A367812         an = k
%o A367812         aset.add(k)
%o A367812         while mink in aset: mink += 1
%o A367812 print(list(islice(agen(), 80))) # _Michael S. Branicky_, Dec 01 2023
%Y A367812 Cf. A118763, A367813, A367814, A367815.
%K A367812 base,nonn
%O A367812 1,2
%A A367812 _Eric Angelini_ and _Giorgos Kalogeropoulos_, Dec 01 2023