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.

A118763 a(n) = smallest number not occurring earlier having in decimal representation to its predecessor Levenshtein distance = 1; a(0)=0.

This page as a plain text file.
%I A118763 #18 Dec 01 2023 18:36:03
%S A118763 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,
%T A118763 25,26,27,29,39,30,31,32,33,34,35,36,37,38,48,40,41,42,43,44,45,46,47,
%U A118763 49,59,50,51,52,53,54,55,56,57,58,68,60,61,62,63,64,65,66,67,69,79,70,71
%N A118763 a(n) = smallest number not occurring earlier having in decimal representation to its predecessor Levenshtein distance = 1; a(0)=0.
%C A118763 Permutation of the natural numbers; inverse: A118764; A118765(n)=a(a(n)); a(A118767(n))=A118767(n);
%C A118763 A118768(n) = a(n+1) - a(n);
%H A118763 Robert G. Wilson v, <a href="/A118763/b118763.txt">Table of n, a(n) for n = 0..10000</a>
%H A118763 Michael Gilleland, <a href="http://people.cs.pitt.edu/~kirk/cs1501/Pruhs/Fall2006/Assignments/editdistance/Levenshtein%20Distance.htm">Levenshtein Distance</a>
%H A118763 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t A118763 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 *)
%o A118763 (Python)
%o A118763 from itertools import islice
%o A118763 from Levenshtein import distance as Ld
%o A118763 def agen(): # generator of terms
%o A118763     an, aset, mink = 0, {0}, 1
%o A118763     while True:
%o A118763         yield an
%o A118763         s, k = str(an), mink
%o A118763         while k in aset or Ld(s, str(k)) != 1: k += 1
%o A118763         an = k
%o A118763         aset.add(k)
%o A118763         while mink in aset: mink += 1
%o A118763 print(list(islice(agen(), 73))) # _Michael S. Branicky_, Dec 01 2023
%Y A118763 Cf. A118757.
%K A118763 nonn,base
%O A118763 0,3
%A A118763 _Reinhard Zumkeller_, May 01 2006