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.

A161133 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having exactly k odd fixed points (0 <= k <= ceiling(n/2)).

Original entry on oeis.org

1, 0, 1, 1, 1, 3, 2, 1, 14, 8, 2, 64, 42, 12, 2, 426, 234, 54, 6, 2790, 1704, 468, 72, 6, 24024, 12864, 3024, 384, 24, 205056, 120120, 32160, 5040, 480, 24, 2170680, 1145400, 272400, 37200, 3000, 120, 22852200, 13024080, 3436200, 544800, 55800
Offset: 0

Views

Author

Emeric Deutsch, Jul 18 2009

Keywords

Comments

Row n contains 1 + ceiling(n/2) entries.
Sum of row n is n! = A000142(n).
T(n,0) = A161131(n).
Sum_{k>=0} k*T(n,k) = A052558(n-1).

Examples

			T(3,0)=3 because we have 312, 231, 321; T(3,2)=1 because we have 123.
Triangle starts:
    1;
    0,   1;
    1,   1;
    3,   2,  1;
   14,   8,  2;
   64,  42, 12, 2;
  426, 234, 54, 6;
		

Crossrefs

Programs

  • Maple
    T := proc (n, k) options operator, arrow: binomial(ceil((1/2)*n), k)*add((-1)^j*binomial(ceil((1/2)*n)-k, j)*factorial(n-k-j), j = 0 .. ceil((1/2)*n)-k) end proc: for n from 0 to 12 do seq(T(n, k), k = 0 .. ceil((1/2)*n)) end do; # yields sequence in triangular form
  • Mathematica
    Flatten[Table[Binomial[Ceiling[n/2], k]*Sum[(-1)^j*(n - k - j)!*Binomial[Ceiling[n/2] - k, j], {j, 0, Ceiling[n/2] - k}],{n, 0, 11}, {k, 0, Ceiling[n/2]}]] (* Indranil Ghosh, Mar 08 2017 *)
  • PARI
    tabf(nn) = { for(n=0, nn, for(k = 0, ceil(n/2), print1(binomial(ceil(n/2), k) * sum(j=0, ceil(n/2) - k, (-1)^j*(n - k - j)! * binomial(ceil(n/2) - k, j)),", ");); print();); };
    tabf(12); \\ Indranil Ghosh, Mar 08 2017

Formula

T(n,k) = binomial(ceiling(n/2), k)*Sum_{j=0..ceiling(n/2)-k} (-1)^j*(n-k-j)!*binomial(ceiling(n/2)-k, j).