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.

A238345 Triangle T(n,k) read by rows: T(n,k) is the number of compositions of n where the k-th part is the first occurrence of a largest part, n>=1, 1<=k<=n.

Original entry on oeis.org

1, 2, 0, 3, 1, 0, 5, 2, 1, 0, 8, 5, 2, 1, 0, 14, 9, 6, 2, 1, 0, 24, 18, 12, 7, 2, 1, 0, 43, 33, 25, 16, 8, 2, 1, 0, 77, 62, 49, 35, 21, 9, 2, 1, 0, 140, 115, 95, 73, 49, 27, 10, 2, 1, 0, 256, 215, 181, 148, 108, 68, 34, 11, 2, 1, 0, 472, 401, 346, 291, 230, 158, 93, 42, 12, 2, 1, 0, 874, 753, 657, 569, 470, 353, 228, 125, 51, 13, 2, 1, 0
Offset: 1

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 25 2014

Keywords

Comments

Column k=1: T(n,1) = A079500(n) = A007059(n+1).
Row sums are A011782.

Examples

			Triangle starts:
01:     1;
02:     2,    0;
03:     3,    1,    0;
04:     5,    2,    1,    0;
05:     8,    5,    2,    1,    0;
06:    14,    9,    6,    2,    1,    0;
07:    24,   18,   12,    7,    2,    1,    0;
08:    43,   33,   25,   16,    8,    2,    1,   0;
09:    77,   62,   49,   35,   21,    9,    2,   1,   0;
10:   140,  115,   95,   73,   49,   27,   10,   2,   1,   0;
11:   256,  215,  181,  148,  108,   68,   34,  11,   2,   1,  0;
12:   472,  401,  346,  291,  230,  158,   93,  42,  12,   2,  1,  0;
13:   874,  753,  657,  569,  470,  353,  228, 125,  51,  13,  2,  1, 0;
14:  1628, 1416, 1250, 1102,  943,  753,  533, 324, 165,  61, 14,  2, 1, 0;
15:  3045, 2673, 2380, 2126, 1866, 1558, 1188, 791, 453, 214, 72, 15, 2, 1, 0;
...
		

Programs

  • Maple
    g:= proc(n, m) option remember; `if`(n=0, 1,
           add(g(n-j, min(n-j, m)), j=1..min(n, m)))
        end:
    h:= proc(n, t, m) option remember; `if`(n=0, 0,
          `if`(t=1, add(g(n-j, j), j=m+1..n),
           add(h(n-j, t-1, max(m, j)), j=1..n)))
        end:
    T:= (n, k)-> h(n, k, 0):
    seq(seq(T(n, k), k=1..n), n=1..15);
  • Mathematica
    g[n_, m_] := g[n, m] = If[n == 0, 1, Sum[g[n-j, Min[n-j, m]], {j, 1, Min[n, m]}]]; h[n_, t_, m_] := h[n, t, m] = If[n == 0, 0, If[t == 1, Sum[g[n-j, j], {j, m+1, n}], Sum[h[n-j, t-1, Max[m, j]], {j, 1, n}]]]; T[n_, k_] := h[n, k, 0]; Table[Table[T[n, k], {k, 1, n}], {n, 1, 15}] // Flatten (* Jean-François Alcover, Jan 12 2015, translated from Maple *)