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.

A072575 Triangle T(n,k) of number of compositions (ordered partitions) of n into distinct parts where largest part is exactly k, 1<=k<=n.

Original entry on oeis.org

1, 0, 1, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 2, 1, 0, 0, 6, 2, 2, 1, 0, 0, 0, 8, 2, 2, 1, 0, 0, 0, 6, 8, 2, 2, 1, 0, 0, 0, 6, 8, 8, 2, 2, 1, 0, 0, 0, 24, 12, 8, 8, 2, 2, 1, 0, 0, 0, 0, 30, 14, 8, 8, 2, 2, 1, 0, 0, 0, 0, 30, 36, 14, 8, 8, 2, 2, 1, 0, 0, 0, 0, 24, 36, 38, 14, 8, 8, 2, 2, 1, 0, 0, 0, 0, 24, 54, 42, 38, 14, 8, 8, 2, 2, 1
Offset: 1

Views

Author

Henry Bottomley, Jun 21 2002

Keywords

Examples

			Rows start:
  1;
  0, 1;
  0, 2, 1;
  0, 0, 2, 1;
  0, 0, 2, 2, 1;
  0, 0, 6, 2, 2, 1;
  0, 0, 0, 8, 2, 2, 1;
  0, 0, 0, 6, 8, 2, 2, 1;
  ...
T(7,4)=8 since 7 can be written as 4+3 =4+2+1 =4+1+2 =3+4 =2+4+1 =2+1+4 =1+4+2 =1+2+4.
		

Crossrefs

Cf. A026836, A072574. Row sums are A032020. Column sums appear to be A001339 (offset). Starting terms of columns tend towards A072576 as k increases.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1,
          `if`(i<1, [][], zip((x, y)->x+y, [b(n, i-1)],
          `if`(i>n, [], [0, b(n-i, i-1)]), 0)[]))
        end:
    T:= proc(n, k) local l; l:= [b(n-k, k-1)];
           add(l[i]*(i)!, i=1..nops(l))
        end:
    seq(seq(T(n, k), k=1..n), n=1..20);  # Alois P. Heinz, Nov 20 2012
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, Plus @@ PadRight[{b[n, i-1], If[i>n, {}, Join[{0}, b[n-i, i-1]]]}]]]; T[n_, k_] := Module[{l}, l = b[n-k, k-1]; Sum[l[[i]]*i!, {i, 1, Length[l]}]]; Table[Table [T[n, k], {k, 1, n}], {n, 1, 20}] // Flatten (* Jean-François Alcover, Jan 31 2014, after Alois P. Heinz *)