%I #20 Feb 18 2017 10:56:01
%S 1,0,1,0,4,0,24,3,0,206,50,0,2300,825,0,31742,14794,120,0,522466,
%T 294987,6090,0,9996478,6547946,232792,0,218088504,160994565,8337420,0,
%U 5344652492,4355845868,299350440,151200,0,145386399554,128831993037,11074483860,18794160
%N Number T(n,k) of endofunctions on [n] with cycles of k distinct lengths; triangle T(n,k), n>=0, 0<=k<=A003056(n), read by rows.
%H Alois P. Heinz, <a href="/A242027/b242027.txt">Rows n = 0..140, flattened</a>
%e T(3,2) = 3: (1,3,2), (3,2,1), (2,1,3).
%e Triangle T(n,k) begins:
%e 00 : 1;
%e 01 : 0, 1;
%e 02 : 0, 4;
%e 03 : 0, 24, 3;
%e 04 : 0, 206, 50;
%e 05 : 0, 2300, 825;
%e 06 : 0, 31742, 14794, 120;
%e 07 : 0, 522466, 294987, 6090;
%e 08 : 0, 9996478, 6547946, 232792;
%e 09 : 0, 218088504, 160994565, 8337420;
%e 10 : 0, 5344652492, 4355845868, 299350440, 151200;
%p with(combinat):
%p b:= proc(n, i, k) option remember; `if`(n=0, `if`(k=0, 1, 0),
%p `if`(i<1 or k<1, 0, add((i-1)!^j*multinomial(n, n-i*j, i$j)/j!*
%p b(n-i*j, i-1, k-`if`(j=0, 0, 1)), j=0..n/i)))
%p end:
%p T:= (n, k)-> add(binomial(n-1, j-1)*n^(n-j)*b(j$2, k), j=0..n):
%p seq(seq(T(n, k), k=0..floor((sqrt(1+8*n)-1)/2)), n=0..14);
%t multinomial[n_, k_] := n!/Times @@ (k!); b[n_, i_, k_] := b[n, i, k] = If[n == 0, If[k==0, 1, 0], If[i<1 || k<1, 0, Sum[(i-1)!^j*multinomial[n, Join[ {n-i*j}, Array[i&, j]]]/j!*b[n-i*j, i-1, k-If[j==0, 0, 1]], {j, 0, n/i}]] ]; T[0, 0] = 1; T[n_, k_] := Sum[Binomial[n-1, j-1]*n^(n-j)*b[j, j, k], {j, 0, n}]; Table[T[n, k], {n, 0, 14}, {k, 0, Floor[(Sqrt[1+8n]-1)/2]}] // Flatten (* _Jean-François Alcover_, Feb 18 2017, translated from Maple *)
%Y Columns k=0-10 give: A000007, A241980 for n>0, A246283, A246284, A246285, A246286, A246287, A246288, A246289, A246290, A246291.
%Y Row sums give A000312.
%Y T(A000217(n),n) gives A246292.
%Y Cf. A003056, A060281, A218868 (the same for permutations).
%K nonn,tabf
%O 0,5
%A _Alois P. Heinz_, Aug 11 2014