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!)
A115780 Consider the Levenshtein distance between k considered as a decimal string and k considered as a binary string. Then a(n) is the number of nonnegative integers having a Levenshtein distance of n. 0

%I #6 Mar 30 2012 17:31:17

%S 2,0,4,8,14,32,60,140,212,750,1322,2540,6862,13040,27174,57052,117164,

%T 248360,555254

%N Consider the Levenshtein distance between k considered as a decimal string and k considered as a binary string. Then a(n) is the number of nonnegative integers having a Levenshtein distance of n.

%C a(n)~2^n. a(n)-2^n: -1,2,0,0,2,0,4,12,44,238,298,492,2766,4848,10790,24284,51628,117288,293110, ...,.

%e a(0)=2 since only 0&1 have a Levenshtein distance of zero when considering them as decimal and binary strings,

%t 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]]]];

%t t = Table[0, {25}]; f[n_] := levenshtein[ IntegerDigits[n], IntegerDigits[n, 2]]; Do[ t[[f@n+1]]++, {n, 10^6}]; t

%Y Cf. A000027, A007088, A115777.

%K more,nonn,base

%O 0,1

%A _Robert G. Wilson v_, Jan 26 2006

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 July 12 23:13 EDT 2024. Contains 374257 sequences. (Running on oeis4.)