A367638 Sequence S of positive integers such that the successive digits d of S are the successive Levenshtein distances between two adjacent terms of S. When possible, S is always extended with the smallest positive integer not yet present.
1, 2, 10, 11, 11, 12, 13, 3, 4, 5, 14, 15, 200, 6, 1000, 22111, 2111, 7, 8, 10000, 100, 100, 100, 222211, 22211, 22211, 22211, 22211, 211, 16, 17, 18, 19, 20, 21, 22, 23, 1000000, 22111111, 2111111, 2111111, 2111111, 2111111, 2111111, 111111, 111111, 111111, 11111, 11111, 11111, 1111, 1111, 1111, 101, 30, 9, 24
Offset: 1
Examples
The sequence starts with 1, 2, 10, 11, 11, 12, 13, 3. a(1) = 1 is indeed the Ld (Levenshtein distance) between a(1) = 1 and a(2) = 2; a(2) = 2 is the Ld between a(2) = 2 and a(3) = 10; a(3) = 10 whose first digit 1 is the Ld between a(3) = 10 and a(4) = 11; a(3) = 10 whose second digit 0 is the Ld between a(4) = 11 and a(5) = 11; a(4) = 11 whose first digit 1 is the Ld between a(5) = 11 and a(6) = 12; a(4) = 11 whose second digit 1 is the Ld between a(6) = 12 and a(7) = 13; a(5) = 11 whose first digit 1 is the Ld between a(7) = 13 and a(8) = 3; etc.
Links
- Éric Angelini, A sequence with Vladimir Iosifovich (and his wife), Personal blog, Nov 2023.
Programs
-
Mathematica
a[1]=1;a[n_]:=a[n]=If[Flatten[IntegerDigits/@(ar=Array[a,n-1])][[n-1]]==0,a[n-1],(k=1;While[MemberQ[ar,k]||EditDistance[ToString@a[n-1],ToString@k]!=Flatten[IntegerDigits/@Join[ar,{k}]][[n-1]],k++];k)];Array[a,23]