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.

A367811 Lexicographically earliest sequence of distinct positive terms such that the Levenshtein distance (Ld) between a(n) and a(n+1) is equal to the first digit of a(n+1).

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