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!)
A118763 a(n) = smallest number not occurring earlier having in decimal representation to its predecessor Levenshtein distance = 1; a(0)=0. 12
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 10, 11, 12, 13, 14, 15, 16, 17, 18, 28, 20, 21, 22, 23, 24, 25, 26, 27, 29, 39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 48, 40, 41, 42, 43, 44, 45, 46, 47, 49, 59, 50, 51, 52, 53, 54, 55, 56, 57, 58, 68, 60, 61, 62, 63, 64, 65, 66, 67, 69, 79, 70, 71 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Permutation of the natural numbers; inverse: A118764; A118765(n)=a(a(n)); a(A118767(n))=A118767(n);
A118768(n) = a(n+1) - a(n);
LINKS
Michael Gilleland, Levenshtein Distance
MATHEMATICA
levenshtein[s_List, t_List] := Module[{d, n = Length@ s, m = Length@ t}, Which[s === t, 0, n == 0, m, m == 0, n, s != t, d = Table[0, {m + 1}, {n + 1}]; d[[1, Range[n + 1]]] = Range[0, n]; d[[Range[m + 1], 1]] = Range[0, m]; Do[ d[[j + 1, i + 1]] = Min[d[[j, i + 1]] + 1, d[[j + 1, i]] + 1, d[[j, i]] + If[ s[[i]] === t[[j]], 0, 1]], {j, m}, {i, n}]; d[[ -1, -1]] ]]; f[lst_] := Block[{k = 1, l = IntegerDigits[ lst[[-1]]]}, While[ MemberQ[lst, k] || levenshtein[l, IntegerDigits[k]] > 1, k++]; Append[lst, k]]; Nest[f, {0}, 100] (* Robert G. Wilson v, Sep 22 2016 *)
PROG
(Python)
from itertools import islice
from Levenshtein import distance as Ld
def agen(): # generator of terms
an, aset, mink = 0, {0}, 1
while True:
yield an
s, k = str(an), mink
while k in aset or Ld(s, str(k)) != 1: k += 1
an = k
aset.add(k)
while mink in aset: mink += 1
print(list(islice(agen(), 73))) # Michael S. Branicky, Dec 01 2023
CROSSREFS
Cf. A118757.
Sequence in context: A180084 A092596 A349732 * A098488 A276597 A199344
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, May 01 2006
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 April 27 07:58 EDT 2024. Contains 372009 sequences. (Running on oeis4.)