Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #21 Dec 16 2021 16:48:52
%S 1,1,1,4,3,2,27,15,8,4,256,112,50,22,10,3125,1125,430,166,66,26,46656,
%T 14256,4752,1626,576,206,76,823543,218491,64484,19768,6310,2054,688,
%U 232,16777216,3932160,1040384,288512,83736,24952,7660,2388,764
%N Number T(n,k) of endofunctions f on [n] that are self-inverse on [k]; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
%C T(n,k) counts endofunctions f:{1,...,n}-> {1,...,n} with f(f(i))=i for all i in {1,...,k}.
%H Alois P. Heinz, <a href="/A245348/b245348.txt">Rows n = 0..140, flattened</a>
%F T(n,k) = Sum_{i=0..min(k,n-k)} C(n-k,i)*C(k,i)*i!*A000085(k-i)*n^(n-k-i).
%e T(3,1) = 15: (1,1,1), (2,1,1), (3,1,1), (1,2,1), (3,2,1), (1,3,1), (3,3,1), (1,1,2), (2,1,2), (1,2,2), (1,3,2), (1,1,3), (2,1,3), (1,2,3), (1,3,3).
%e T(3,2) = 8: (2,1,1), (1,2,1), (3,2,1), (2,1,2), (1,2,2), (1,3,2), (2,1,3), (1,2,3).
%e T(3,3) = 4: (3,2,1), (1,3,2), (2,1,3), (1,2,3).
%e Triangle T(n,k) begins:
%e 0 : 1;
%e 1 : 1, 1;
%e 2 : 4, 3, 2;
%e 3 : 27, 15, 8, 4;
%e 4 : 256, 112, 50, 22, 10;
%e 5 : 3125, 1125, 430, 166, 66, 26;
%e 6 : 46656, 14256, 4752, 1626, 576, 206, 76;
%e 7 : 823543, 218491, 64484, 19768, 6310, 2054, 688, 232;
%e ...
%p g:= proc(n) g(n):= `if`(n<2, 1, g(n-1)+(n-1)*g(n-2)) end:
%p T:= (n, k)-> add(binomial(n-k, i)*binomial(k, i)*i!*
%p g(k-i)*n^(n-k-i), i=0..min(k, n-k)):
%p seq(seq(T(n,k), k=0..n), n=0..10);
%t g[n_] := g[n] = If[n<2, 1, g[n-1] + (n-1)*g[n-2]]; T[0, 0] = 1; T[n_, k_] := Sum[Binomial[n-k, i]*Binomial[k, i]*i!*g[k-i]*n^(n-k-i), {i, 0, Min[k, n-k]}]; Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Feb 19 2017, translated from Maple *)
%Y Columns k=0-1 give: A000312, A089945(n-1) for n>0.
%Y Main diagonal gives A000085.
%Y T(2n,n) gives A245141.
%Y Cf. A239771, A245692.
%K nonn,tabl
%O 0,4
%A _Alois P. Heinz_, Jul 18 2014