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.

A157011 Triangle T(n,k) read by rows: T(n,k)= (k-1)*T(n-1,k) + (n-k+2)*T(n-1, k-1), with T(n,1)=1, for 1 <= k <= n, n >= 1.

Original entry on oeis.org

1, 1, 2, 1, 5, 4, 1, 9, 23, 8, 1, 14, 82, 93, 16, 1, 20, 234, 607, 343, 32, 1, 27, 588, 2991, 3800, 1189, 64, 1, 35, 1365, 12501, 30155, 21145, 3951, 128, 1, 44, 3010, 47058, 195626, 256500, 108286, 12749, 256, 1, 54, 6416, 165254, 1111910, 2456256, 1932216, 522387, 40295, 512
Offset: 1

Views

Author

Roger L. Bagula, Feb 21 2009

Keywords

Comments

Row sums are apparently in A002627.
The Mathematica code gives ten sequences of which the first few are in the OEIS (see Crossrefs section). - G. C. Greubel, Feb 22 2019

Examples

			The triangle starts in row n=1 as:
  1;
  1,  2;
  1,  5,    4;
  1,  9,   23,      8;
  1, 14,   82,     93,      16;
  1, 20,  234,    607,     343,      32;
  1, 27,  588,   2991,    3800,    1189,      64;
  1, 35, 1365,  12501,   30155,   21145,    3951,    128;
  1, 44, 3010,  47058,  195626,  256500,  108286,  12749,   256;
  1, 54, 6416, 165254, 1111910, 2456256, 1932216, 522387, 40295, 512;
		

Crossrefs

Cf. A000096 (column k=1), A002627, A008517.
Cf. This sequence (m=0), A008292 (m=1), A157012 (m=2), A157013 (m=3).

Programs

  • Maple
    A157011 := proc(n,k) if k <0 or k >= n then 0; elif k  =0 then 1; else k*procname(n-1,k)+(n-k+1)*procname(n-1,k-1) ; end if; end proc: # R. J. Mathar, Jun 18 2011
  • Mathematica
    e[n_, 0, m_]:= 1;
    e[n_, k_, m_]:= 0 /; k >= n;
    e[n_, k_, m_]:= (k+m)*e[n-1, k, m] + (n-k+1-m)*e[n-1, k-1, m];
    Table[Flatten[Table[Table[e[n, k, m], {k,0,n-1}], {n,1,10}]], {m,0,10}]
    T[n_, 1]:= 1; T[n_, n_]:= 2^(n-1); T[n_, k_]:= T[n, k] = (k-1)*T[n-1, k] + (n-k+2)*T[n-1, k-1]; Table[T[n, k], {n, 1, 10}, {k, 1, n}]//Flatten (* G. C. Greubel, Feb 22 2019 *)
  • PARI
    {T(n, k) = if(k==1, 1, if(k==n, 2^(n-1), (k-1)*T(n-1, k) + (n-k+2)* T(n-1, k-1)))};
    for(n=1, 10, for(k=1, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Feb 22 2019
    
  • Sage
    def T(n, k):
        if (k==1):
            return 1
        elif (k==n):
            return 2^(n-1)
        else: return (k-1)*T(n-1, k) + (n-k+2)* T(n-1, k-1)
    [[T(n, k) for k in (1..n)] for n in (1..10)] # G. C. Greubel, Feb 22 2019