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.

Showing 1-3 of 3 results.

A109382 Levenshtein distance between successive English names of nonnegative integers, excluding spaces and hyphens.

Original entry on oeis.org

4, 3, 4, 5, 3, 3, 4, 5, 4, 3, 4, 4, 6, 3, 3, 2, 4, 4, 3, 7, 3, 3, 4, 5, 3, 3, 4, 5, 4, 7, 3, 3, 4, 5, 3, 3, 4, 5, 4, 7, 3, 3, 4, 5, 3, 3, 4, 5, 4, 6, 3, 3, 4, 5, 3, 3, 4, 5, 4, 6, 3, 3, 4, 5, 3, 3, 4, 5, 4, 7, 3, 3, 4, 5, 3, 3, 4, 5, 4, 8, 3, 3, 4, 5, 3, 3, 4, 5, 4, 7, 3, 3, 4, 5, 3, 3, 4, 5, 4, 7, 3, 3, 4, 5, 3, 3
Offset: 0

Views

Author

Jonathan Vos Post, Aug 25 2005

Keywords

Examples

			a(0) = 4 since LD(ZERO,ONE) requires 4 edits.
a(1) = 3 since LD(ONE,TWO) which requires 3 substitutions.
a(2) = 4 since LD(TWO,THREE) = requires 4 edits (leave the leftmost T unchanged), then 2 substitutions (W to H, O to R), then 2 insertions (E,E).
a(4) = 3 as LD(FOUR,FIVE) leaves the leftmost F unchanged, then requires 3 substitutions. From FIVE to SIX leaves the I unchanged. From SIX to SEVEN leaves the S unchanged. From TEN to ELEVEN leaves the EN unchanged. From ELEVEN to TWELVE leaves an E,L,V,E unchanged. From THIRTEEN to FOURTEEN leaves RTEEN unchanged. TWENTYNINE to THIRTY takes 7 edits. THIRTYNINE to FORTY takes 7 edits. SEVENTYNINE to EIGHTY takes 8 edits. EIGHTYNINE to NINETY takes 7 edits. NINETYNINE to ONEHUNDRED takes 7 edits.
		

Crossrefs

Programs

  • Maple
    with(StringTools):
    seq(Levenshtein(Select(IsAlpha, convert(n,english)),Select(IsAlpha,convert(n+1,english))),n=0..200); # Robert Israel, Jan 23 2018
  • Mathematica
    (* First copy b109382.txt out of A109382 then *) 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[x_] := Block[{str = ToString@ lst[[x]], len}, len = StringLength@ str; StringInsert[str, ",", Range[2, len]]]

Formula

a(n) = LD(nameof(n), nameof(n+1)).

Extensions

More terms from Robert G. Wilson v, Jan 31 2006
Corrected by Robert Israel, Jan 23 2018

A109378 Semiprimes at Levenshtein distance n from previous value when considered as a decimal string.

Original entry on oeis.org

4, 6, 10, 221, 1003, 22226, 100001, 2222245, 10000001, 222222223, 1000000006, 2222222227, 100000000013, 2222222222249, 10000000000015, 222222222222223, 10000000000000031, 22222222222222229, 100000000000000015
Offset: 0

Views

Author

Jonathan Vos Post, Aug 25 2005

Keywords

Comments

For positive n, the string length of a(n+1) is always the 1 + the string length of a(n). This sequence is infinite.

Examples

			a(0) = 4 = 2^2.
a(1) = 6 because we transform a(0) = 4 to 6 = 2 * 3 (a semiprime) with one substitution.
a(2) = 10 because we transform a(1) = 6 to 10 = 2 * 5 with one substitution and one insertion.
a(3) = 221 because we transform a(2) = 10 to the least semiprime 221 = 13 * 17 with 1 substitution plus two insertion.
a(4) = 1003 because we transform a(3) = 221 to the least semiprime 1003 = 17 * 59 with 3 substitutions plus one insertion and any smaller semiprime can be transformed from 221 in fewer than 4 steps.
a(20) = 10000000000000000001 = 11 * 909090909090909091, which is the least semiprime of Levenshtein distance 20 from a(19) = 2222222222222222222 from which decimal string we transform to a(20) with 19 substitutions and one insertion.
		

Crossrefs

A109380 Levenshtein distance between successive factorials when considered as decimal strings.

Original entry on oeis.org

0, 1, 1, 2, 2, 1, 3, 3, 5, 1, 4, 5, 7, 7, 9, 9, 10, 12, 13, 14, 12, 12, 16, 15, 17, 16, 19, 16, 21, 24, 21, 22, 22, 25, 25, 25, 27, 32, 33, 30, 34, 34, 36, 36, 37, 38, 38, 44, 42, 44, 42, 46, 47, 48, 50, 50, 47, 52, 52, 49, 54, 60, 60, 59, 56, 60, 62, 68, 70, 65, 65, 67, 70, 70, 74
Offset: 0

Views

Author

Jonathan Vos Post, Aug 25 2005

Keywords

Examples

			a(0) = 0 since LD(0!,1!) = LD(1,1) which requires 0 edits.
a(1) = 1 since LD(1!,2!) = LD(1,2) which requires 1 substitution.
a(2) = 1 since LD(2!,3!) = LD(2,6) which requires 1 substitution.
a(3) = 2 since LD(3!,4!) = LD(6,24) which requires 1 substitution and 1 insertion.
a(4) = 2 since LD(4!,5!) = LD(24,120) which requires 1 insertion (1 to the left of 2) and 1 substitution (from 4 to 0).
a(5) = 1 since LD(5!,6!) = LD(120,720) which requires 1 substitution (from 1 to 7).
a(6) = 3 since LD(6!,7!) = LD(720,5040) which requires 1 substitution (from 7 to 5), then 2 insertions (0 to right of 7, 4 to right of 7) and leaving the rightmost digit unedited.
a(7) = 3 as it takes a minimum of 3 edits to get from 5040 to 40320.
a(8) = 5 since LD(8!,9!) = LD(40320,362880) which requires 5 edits.
a(9) = 1 since LD(9!,10!) = LD(362880,3628800) which requires 1 insertion of a zero.
a(10) = 4 since LD(10!,11!) = LD(3628800,39916800) which takes 4 edits.
		

Crossrefs

Programs

  • 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 + 1)! ]]; Table[ f[n], {n, 0, 74}] (* Robert G. Wilson v *)

Formula

a(n) = LD(n!,(n+1)!).

Extensions

Corrected and extended by Robert G. Wilson v, Jan 25 2006
Showing 1-3 of 3 results.