login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 0
1, 10, 2, 12, 11, 13, 14, 15, 16, 17, 18, 19, 20, 120, 3, 21, 121, 22, 122, 23, 123, 24, 124, 25, 125, 26, 126, 27, 127, 28, 128, 29, 129, 30, 130, 100, 31, 131, 101, 32, 132, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
Éric Angelini, More Levenshtein distances, Personal blog, December 2023.
EXAMPLE
a(1) = 1 and a(2) = 10 are separated by an Ld of 1, and 1 is the 1st digit of a(2)
a(2) = 10 and a(3) = 2 are separated by an Ld of 2, and 2 is the 1st digit of a(3)
a(3) = 2 and a(4) = 12 are separated by an Ld of 1, and 1 is the 1st digit of a(4)
a(4) = 12 and a(5) = 11 are separated by an Ld of 1, and 1 is the 1st digit of a(5)
a(5) = 11 and a(6) = 13 are separated by an Ld of 1, and 1 is the 1st digit of a(6) etc.
MATHEMATICA
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]
PROG
(Python)
from itertools import islice
from Levenshtein import distance as Ld
def agen(): # generator of terms
an, aset, mink = 1, {1}, 2
while True:
yield an
s, k = str(an), mink
while k in aset or Ld(s, sk:=str(k)) != int(sk[0]): k += 1
an = k
aset.add(k)
while mink in aset: mink += 1
print(list(islice(agen(), 68))) # Michael S. Branicky, Dec 01 2023
CROSSREFS
Cf. A367810.
Sequence in context: A084455 A069532 A084461 * A364188 A326107 A005483
KEYWORD
base,nonn
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 29 16:03 EDT 2024. Contains 373851 sequences. (Running on oeis4.)