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-4 of 4 results.

A160094 a(n) = 1 + A122840(n).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Anonymous, May 01 2009

Keywords

Comments

a(n) is the Levenshtein distance from the decimal expansion of n - 1 to the decimal expansion of n. For example, to convert "9" to "10", substitute "0" for "9" and insert "1". Since two such operations are required, a(10) = 2. See the analogous A091090 (binary expansion) and A115777 (full definition). - Rick L. Shepherd, Mar 25 2015

Examples

			a(160) = 2 because the last nonzero digit of 160 (counting from left to right), when 160 is written in base 10, is 6, and that 6 occurs 2 digits from the right in 160.
		

Crossrefs

Programs

  • Mathematica
    IntegerExponent[Range[150]]+1 (* Harvey P. Dale, Feb 06 2015 *)

Formula

From Hieronymus Fischer, Jun 08 2012: (Start)
With m = floor(log_10(n)), frac(x) = x-floor(x):
a(n) = Sum_{j=0..m} (1 - ceiling(frac(n/10^j))).
a(n) = m + 1 + Sum_{j=1..m} (floor(-frac(n/10^j))).
a(n) = 1 + A054899(n) - A054899(n-1).
G.f.: g(x) = (x/(1-x)) + Sum_{j>0} x^10^j/(1-x^10^j). (End)
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 10/9. - Amiram Eldar, Jul 10 2023
a(n) = A122840(10*n). - R. J. Mathar, Jun 28 2025

Extensions

Name simplified by Jon E. Schoenfield, Feb 26 2014

A115778 Consider the Levenshtein distance between k considered as a decimal string and k considered as a binary string. Then a(n) is the least number m such that the Levenshtein distance is n or 0 if no such number exists.

Original entry on oeis.org

1, 0, 2, 4, 8, 22, 32, 64, 222, 256, 512, 2044, 2222, 4222, 8192, 22222, 32768, 65536, 222222, 262144, 524288, 2097152, 2222222, 4194322, 8388622, 22222222, 33554432, 67222222, 222222222, 268435456, 536872222, 2147483650, 2147483648, 4294967296, 8589934592, 22222222222
Offset: 0

Views

Author

Robert G. Wilson v, Jan 26 2006

Keywords

Comments

Difference between A115779 and A115778: 1, 0, 9, 11, 103, 99, 979, 1047, 1789, 10855, 15599, 109067, 128789, 1006889, 1102919, 1988889, 11078343, ...,.

Crossrefs

Programs

  • Maple
    f:= n -> StringTools:-Levenshtein(convert(n,string), convert(convert(n,binary),string)):
    A:= Vector(20):
    for n from 3 to 10^6 do
      v:= f(n);
      if A[v] = 0 then A[v]:= n fi
    od:
    1,0,seq(A[n],n=2..20); # Robert Israel, Jul 16 2015
  • 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[a = f[n]; If[ t[[a+1]] == 0, t[[a+1]] = n; Print[{a, n}]], {n, 10^6}]; t

Formula

a(1)=0 since no number satisfies the definition and generally a(n)>= 2^(n+1).

Extensions

a(26)-a(35) from Lars Blomberg, Jul 16 2015

A115779 Consider the Levenshtein distance between k considered as a decimal string and k considered as a binary string. Then a(n) is the greatest number m such that the Levenshtein distance is n or 0 if no such number exists.

Original entry on oeis.org

1, 0, 11, 15, 111, 121, 1011, 1111, 2011, 11111, 16111, 111111, 131011, 1011111, 1111111, 2011111, 11111111, 16111111, 111111111, 131111111, 1011111111, 1111111111, 2111111111, 11111111111
Offset: 0

Views

Author

Robert G. Wilson v, Jan 26 2006

Keywords

Comments

Difference between A115779&A115778: 1, 0, 9, 11, 103, 99, 979, 1047, 1789, 10855, 15599, 109067, 128789, 1006889, 1102919, 1988889, 11078343, ...,.

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

Formula

a(1)=0 since no number satisfies the definition and generally a(n)>= 2^(n+1).

Extensions

a(18)-a(23) from Lars Blomberg, Jul 16 2015

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.

Original entry on oeis.org

2, 0, 4, 8, 14, 32, 60, 140, 212, 750, 1322, 2540, 6862, 13040, 27174, 57052, 117164, 248360, 555254
Offset: 0

Views

Author

Robert G. Wilson v, Jan 26 2006

Keywords

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

Examples

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

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