%I #20 Nov 03 2016 09:32:54
%S 1,1,12,249,7744,326745,17773056,1197261289,97165842432,9294416254161,
%T 1030298497753600,130527793649586201,18685034341191917568,
%U 2993332161753700720681,532270629438646194561024,104316725427708352041239625,22394627939996943667912769536
%N Number of pairs of functions f, g on a size n set into itself satisfying f(g(g(x))) = f(x).
%H Alois P. Heinz, <a href="/A239777/b239777.txt">Table of n, a(n) for n = 0..200</a>
%p s:= proc(n, i) option remember; `if`(i=0, [[]],
%p map(x-> seq([j, x[]], j=1..n), s(n, i-1)))
%p end:
%p a:= proc(n) (l-> add(add(`if`([true$n]=[seq(evalb(
%p f[g[g[i]]]=f[i]), i=1..n)], 1, 0), g=l), f=l))(s(n$2))
%p end:
%p seq(a(n), n=0..5); # _Alois P. Heinz_, Jul 16 2014
%p # second Maple program:
%p with(combinat):
%p b:= proc(n, i) option remember; `if`(n=0 or i=1, x^n,
%p expand(add((i-1)!^j*multinomial(n, n-i*j, i$j)/j!
%p *x^((2-irem(i, 2))*j)*b(n-i*j, i-1), j=0..n/i)))
%p end:
%p a:= n-> add((p-> add(n^i*binomial(n-1, k-1)*n^(n-k)*
%p coeff(p, x, i), i=0..degree(p)))(b(k$2)), k=0..n):
%p seq(a(n), n=0..20); # _Alois P. Heinz_, Aug 06 2014
%t c[n_] := c[n] =
%t Sum[(n - 1)! n^(n - k)/(n - k)! t^(1 + Mod[k + 1, 2]), {k, 1, n}]
%t d[0] = 1
%t d[n_] := d[n] = Sum[Binomial[n - 1, k]*d[k]*c[n - k], {k, 0, n - 1}]
%t a[n_] := d[n] /. t -> n
%t Table[a[n], {n, 1, 10}] (* _David Einstein_, Nov 02 2016*)
%Y Cf. A181162, A239769, A239773.
%Y Column k=2 of A245910.
%K nonn
%O 0,3
%A _Chad Brewbaker_, Mar 26 2014
%E a(6)-a(7) from _Giovanni Resta_, Mar 28 2014
%E a(8)-a(16) from _Alois P. Heinz_, Aug 06 2014