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.

A152487 Triangle read by rows, 0<=k<=n: T(n,k) = Levenshtein distance of n and k in binary representation.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 06 2008

Keywords

Comments

T(n,k) gives number of editing steps (replace, delete and insert) to transform n to k in binary representations;
row sums give A152488; central terms give A057427;
T(n,k) <= Hamming-distance(n,k) for n and k with A070939(n)=A070939(k);
T(n,0) = A000523(n+1);
T(n,1) = A000523(n) for n>0;
T(n,3) = A106348(n-2) for n>2;
T(n,n-1) = A091090(n-1) for n>0;
T(n,n) = A000004(n);
T(A000290(n),n) = A091092(n).
T(n,k) >= A322285(n,k) - Pontus von Brömssen, Dec 02 2018

Examples

			The triangle T(n, k) begins:
  n\k  0  1  2  3  4  5  6  7  8  9 10 11 12 13 ...
   0:  0
   1:  1  0
   2:  1  1  0
   3:  2  1  1  0
   4:  2  2  1  2  0
   5:  2  2  1  1  1  0
   6:  2  2  1  1  1  2  0
   7:  3  2  2  1  2  1  1  0
   8:  3  3  2  3  1  2  2  3  0
   9:  3  3  2  2  1  1  2  2  1  0
  10:  3  3  2  2  1  1  1  2  1  2  0
  11:  3  3  2  2  2  1  2  1  2  1  1  0
  12:  3  3  2  2  1  2  1  2  1  2  2  3  0
  13:  3  3  2  2  2  1  1  1  2  1  2  2  1  0
  ...
The distance between the binary representations of 46 and 25 is 4 (via the edits "101110" - "10111" - "10011" - "11011" - "11001"), so T(46,25) = 4. - _Pontus von Brömssen_, Dec 02 2018
		

Crossrefs

Formula

T(n,k) = f(n,k) with f(x,y) = if x>y then f(y,x) else if x<=1 then Log2(y)-0^y+(1-x)*0^(y+1-2^(y+1)) else Min{f([x/2],[y/2]) + (x mod 2) XOR (y mod 2), f([x/2],y)+1, f(x,[y/2])+1}, where Log2=A000523.

A091093 In ternary representation: minimal number of editing steps (delete, insert or substitute) to transform n into n^2.

Original entry on oeis.org

0, 0, 2, 1, 1, 2, 3, 2, 3, 2, 2, 4, 2, 4, 3, 3, 4, 4, 4, 4, 5, 3, 4, 3, 4, 3, 4, 3, 3, 4, 3, 3, 3, 5, 3, 5, 3, 3, 5, 5, 5, 6, 4, 3, 4, 4, 4, 5, 5, 4, 4, 5, 5, 5, 5, 5, 6, 5, 5, 5, 6, 4, 5, 4, 4, 5, 5, 4, 5, 4, 5, 5, 5, 4, 6, 4, 5, 4, 5, 4, 5, 4, 4, 5, 4, 4, 4, 5, 5, 5, 4, 4, 6, 4, 5, 4, 4, 5, 5, 5, 5, 6
Offset: 0

Views

Author

Reinhard Zumkeller, Dec 18 2003

Keywords

Examples

			a(12)=2: 12->'110', insert a 2 between the 1's and insert a 0 at the end: '12100'->144=12^2.
		

Crossrefs

Programs

  • Maple
    A091093:= proc(x) local L1, L2;
       L1:= convert(map(`+`,ListTools:-Reverse(convert(x,base,3)),48),bytes);
       L2:= convert(map(`+`,ListTools:-Reverse(convert(x^2,base,3)),48),bytes);
       StringTools:-Levenshtein(L1,L2)
    end proc:
    seq(A091093(i),i=0..1000); # Robert Israel, May 06 2014

Formula

a(n) = LevenshteinDistance(A007089(n), A001738(n)).

A091091 Numbers needing in binary and ternary representation an equal minimal number of editing steps (delete, insert or substitute) to transform them into their square.

Original entry on oeis.org

0, 1, 5, 6, 8, 11, 13, 16, 17, 18, 19, 33, 35, 38, 40, 56, 60, 74, 122, 123, 133, 143, 146, 164, 168, 173, 299, 350, 365, 429, 497, 515, 527, 564, 566, 593, 608, 611, 710, 1031, 1050, 1052, 1059, 1088, 1089, 1090, 1092, 1096, 1105, 1287, 1301, 1316, 1322
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 18 2003

Keywords

Comments

A091092(a(n)) = A091093(a(n)).

Crossrefs

Showing 1-3 of 3 results.