login
Triangular array read by rows: T(n,k) is the number of functions f:{1,2,...,n}->{1,2,...,n} with exactly k elements x such that |f^(-1)(x)| = 1; n>=0, 0<=k<=n.
3

%I #32 Feb 07 2020 20:26:51

%S 1,0,1,2,0,2,3,18,0,6,40,48,144,0,24,205,1000,600,1200,0,120,2556,

%T 7380,18000,7200,10800,0,720,24409,125244,180810,294000,88200,105840,

%U 0,5040,347712,1562176,4007808,3857280,4704000,1128960,1128960,0,40320

%N Triangular array read by rows: T(n,k) is the number of functions f:{1,2,...,n}->{1,2,...,n} with exactly k elements x such that |f^(-1)(x)| = 1; n>=0, 0<=k<=n.

%C Row sums = n^n, all functions f:{1,2,...,n}->{1,2,...,n}.

%C T(n,n)= n!, bijections on {1,2,...,n}.

%H Alois P. Heinz, <a href="/A206823/b206823.txt">Table of n, a(n) for n = 0..140, flattened</a>

%F E.g.f.: Sum_{k=0..n} T(n,k) * y^k * x^n / n! = (exp(x) - x + y*x)^n.

%e Triangle T(n,k) begins:

%e 1;

%e 0 1;

%e 2 0 2;

%e 3 18 0 6;

%e 40 48 144 0 24;

%e 205 1000 600 1200 0 120;

%e ...

%p with(combinat): C:= binomial:

%p b:= proc(t, i, u) option remember; `if`(t=0, 1,

%p `if`(i<2, 0, b(t, i-1, u) +add(multinomial(t, t-i*j, i$j)

%p *b(t-i*j, i-1, u-j)*u!/(u-j)!/j!, j=1..t/i)))

%p end:

%p T:= (n, k)-> C(n, k)*C(n, k)*k! *b(n-k$2, n-k):

%p seq(seq(T(n, k), k=0..n), n=0..10); # _Alois P. Heinz_, Nov 13 2013

%t nn = 8; Prepend[CoefficientList[Table[n! Coefficient[Series[(Exp[x] - x + y x)^n, {x, 0, nn}], x^n], {n, 1, nn}], y], {1}] // Flatten

%Y Row sums give: A000312.

%Y Column k=0 gives: A231797.

%Y Cf. A231602.

%K nonn,tabl

%O 0,4

%A _Geoffrey Critzer_, Feb 12 2012