

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



2, 0, 4, 8, 14, 32, 60, 140, 212, 750, 1322, 2540, 6862, 13040, 27174, 57052, 117164, 248360, 555254
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,1


COMMENTS

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, ...,.


LINKS

Table of n, a(n) for n=0..18.


EXAMPLE

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


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]]]];
t = Table[0, {25}]; f[n_] := levenshtein[ IntegerDigits[n], IntegerDigits[n, 2]]; Do[ t[[f@n+1]]++, {n, 10^6}]; t


CROSSREFS

Cf. A000027, A007088, A115777.
Sequence in context: A325416 A120554 A120710 * A101189 A295321 A001443
Adjacent sequences: A115777 A115778 A115779 * A115781 A115782 A115783


KEYWORD

more,nonn,base


AUTHOR

Robert G. Wilson v, Jan 26 2006


STATUS

approved



