Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A081230
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A081230 a(n) is the Levenshtein distance between n and n^n (where each is treated as a string). +0
8
0, 1, 2, 3, 3, 4, 6, 8, 8, 9, 10, 11, 13, 16, 17, 18, 19, 22, 23, 26, 26, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 86, 88, 90, 92, 94, 96, 99, 101, 103, 105, 107, 110, 112, 114, 116, 119, 121, 123, 125 (list; graph; listen)
OFFSET

1,3

LINKS

M. Gilleland, Levenshtein Distance. [It has been suggested that this algorithm gives incorrect results sometimes. - N. J. A. Sloane (njas(AT)research.att.com)]

EXAMPLE

a(9)=8 since we can transform 9 into 9^9=387420489 by 8 insertions, namely inserting 3,8,7,4,2,0,4 and 8 in front of 9. a(2)=1 since we can transform 2 into 2^2=4 by one substitution, namely 4 for 2.

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[n_] := levenshtein[IntegerDigits[n], IntegerDigits[n^n]]; Array[f, 69] (* Robert G. Wilson v *)

CROSSREFS

Cf. A081231, A081232, A081233, A081234, A081235.

Sequence in context: A123552 A071610 A117275 this_sequence A036021 A036025 A036030

Adjacent sequences: A081227 A081228 A081229 this_sequence A081231 A081232 A081233

KEYWORD

nonn,base

AUTHOR

Francois Jooste (pin(AT)myway.com), Mar 11 2003

EXTENSIONS

Corrected by Robert G. Wilson v (rgwv(at)rgwv.com), Jan 25 2006

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 25 20:09 EST 2009. Contains 167514 sequences.


AT&T Labs Research