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.

A220417 Table T(n,k) = k^n - n^k, n, k > 0, read by descending antidiagonals.

Original entry on oeis.org

0, 1, -1, 2, 0, -2, 3, 1, -1, -3, 4, 0, 0, 0, -4, 5, -7, -17, 17, 7, -5, 6, -28, -118, 0, 118, 28, -6, 7, -79, -513, -399, 399, 513, 79, -7, 8, -192, -1844, -2800, 0, 2800, 1844, 192, -8, 9, -431, -6049, -13983, -7849, 7849, 13983, 6049, 431, -9, 10, -924, -18954, -61440, -61318, 0, 61318, 61440, 18954, 924, -10
Offset: 1

Views

Author

Boris Putievskiy, Dec 14 2012

Keywords

Examples

			The table T(n,k) (with rows n >= 1 and columns k >= 1) begins as follows:
   0   1     2      3       4       5 ...
  -1   0     1      0      -7     -28 ...
  -2  -1     0    -17    -118    -513 ...
  -3   0    17      0    -399   -2800 ...
  -4   7   118    399       0   -7849 ...
  -5  28   513   2800    7849       0 ...
  ...
The start of the sequence as a triangular array, read by rows (i.e., descending antidiagonals of T(n,k)), is as follows:
  0;
  1,  -1;
  2,   0,   -2;
  3,   1,   -1, -3;
  4,   0,    0,  0,  -4;
  5,  -7,  -17, 17,   7, -5;
  6, -28, -118,  0, 118, 28, -6;
  ...
In the above triangle, row number m contains m numbers: m^1 - 1^m, (m-1)^2 - 2^(m-1), ..., 1^m - m^1.
		

Crossrefs

Programs

  • PARI
    matrix(9, 9, n, k, k^n - n^k) \\ Michel Marcus, Oct 04 2019
  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    m=((t*t+3*t+4)/2-n)**(n-t*(t+1)/2)-(n-t*(t+1)/2)**((t*t+3*t+4)/2-n)
    

Formula

As a linear array, the sequence is a(n) = A004736(n)^A002260(n) - A002260(n)^A004736(n) or
a(n) = ((t*t + 3*t + 4)/2 - n)^(n - t*(t + 1)/2) - (n - t*(t + 1)/2)^((t*t + 3*t + 4)/2 - n) where t = floor((-1 + sqrt(8*n - 7))/2).