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.

A241719 Number T(n,k) of compositions of n into distinct parts with exactly k descents; triangle T(n,k), n>=0, 0<=k<=max(floor((sqrt(1+8*n)-3)/2),0), read by rows.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 3, 2, 4, 6, 1, 5, 7, 1, 6, 11, 2, 8, 16, 3, 10, 31, 15, 1, 12, 36, 16, 1, 15, 55, 29, 2, 18, 71, 41, 3, 22, 101, 65, 5, 27, 147, 144, 32, 1, 32, 188, 179, 35, 1, 38, 245, 269, 63, 2, 46, 327, 382, 93, 3, 54, 421, 549, 148, 5, 64, 540, 739, 205, 7
Offset: 0

Views

Author

Alois P. Heinz, Apr 27 2014

Keywords

Examples

			T(6,0) = 4: [6], [2,4], [1,5], [1,2,3].
T(6,1) = 6: [5,1], [4,2], [3,1,2], [1,3,2], [2,1,3], [2,3,1].
T(6,2) = 1: [3,2,1].
T(7,0) = 5: [7], [3,4], [2,5], [1,6], [1,2,4].
T(7,1) = 7: [6,1], [4,3], [5,2], [2,1,4], [1,4,2], [2,4,1], [4,1,2].
T(7,2) = 1: [4,2,1].
Triangle T(n,k) begins:
00:   1;
01:   1;
02:   1;
03:   2,   1;
04:   2,   1;
05:   3,   2;
06:   4,   6,   1;
07:   5,   7,   1;
08:   6,  11,   2;
09:   8,  16,   3;
10:  10,  31,  15,  1;
11:  12,  36,  16,  1;
12:  15,  55,  29,  2;
13:  18,  71,  41,  3;
14:  22, 101,  65,  5;
15:  27, 147, 144, 32, 1;
		

Crossrefs

Row sums give A032020.
T(A000217(k+1)-1,k-1) = A000041(k) for k>0.
Cf. A052146.

Programs

  • Maple
    g:= proc(u, o) option remember; `if`(u+o=0, 1, expand(
          add(g(u+j-1, o-j)  , j=1..o)+
          add(g(u-j, o+j-1)*x, j=1..u)))
        end:
    b:= proc(n, i) option remember; local m; m:= i*(i+1)/2;
          `if`(n>m, 0, `if`(n=m, x^i,
          expand(b(n, i-1) +`if`(i>n, 0, x*b(n-i, i-1)))))
        end:
    T:= n-> (p-> (q-> seq(coeff(q, x, i), i=0..degree(q)))(add(
             coeff(p, x, k)*g(0, k), k=0..degree(p))))(b(n$2)):
    seq(T(n), n=0..20);
  • Mathematica
    g[u_, o_] := g[u, o] = If[u+o == 0, 1, Expand[Sum[g[u+j-1, o-j], {j, 1, o}] + Sum[g[u-j, o+j-1]*x, {j, 1, u}]]]; b[n_, i_] := b[n, i] = Module[{m}, m = i*(i+1)/2; If[n>m, 0, If[n == m, x^i, Expand[b[n, i-1] + If[i>n, 0, x*b[n-i, i-1]]]]]]; T[n_] := Function [p, Function[q, Table[Coefficient[q, x, i], {i, 0, Exponent[q, x]}]][Sum[Coefficient[p, x, k]*g[0, k], {k, 0, Exponent[p, x]}]]][b[n, n]]; Table[T[n], {n, 0, 20}] // Flatten (* Jean-François Alcover, Apr 28 2014, after Alois P. Heinz *)