%I #22 Nov 23 2017 02:42:28
%S 1,5,43,529,8451,167397,3984807,111319257,3583777723,131082199809,
%T 5385265586075,246172834737485,12422776100542887,687441750763500441,
%U 41475644663003037947,2714680813135603845921
%N Number of idempotents of rank 1 in partition monoid P_n.
%H I. Dolinka, J. East, A. Evangelou, D. FitzGerald, N. Ham, et al., <a href="http://arxiv.org/abs/1408.2021">Enumeration of idempotents in diagram semigroups and algebras</a>, arXiv preprint arXiv:1408.2021 [math.GR], 2014. See Table 3.
%p e256033 := proc(n,r,s)
%p option remember;
%p local resu,m,a,b;
%p if n <= 0 then
%p return 0;
%p end if;
%p if s = 1 then
%p combinat[stirling2](n,r) ;
%p elif r= 1 then
%p combinat[stirling2](n,s) ;
%p else
%p resu := s*procname(n-1,r-1,s)+r*procname(n-1,r,s-1)+r*s*procname(n-1,r,s) ;
%p for m from 1 to n-2 do
%p for a from 1 to r-1 do
%p for b from 1 to s-1 do
%p resu := resu + binomial(n-2,m) *(a*(s-b)+b*(r-a))
%p *procname(m,a,b)*procname(n-m-1,r-a,s-b);
%p end do:
%p end do:
%p end do:
%p resu ;
%p end if;
%p end proc:
%p A256033 := proc(n)
%p a := 0 ;
%p for r from 1 to n do
%p for s from 1 to n do
%p a := a+r*s*e256033(n,r,s) ;
%p end do;
%p end do;
%p end proc:
%p seq(A256033(n),n=1..16) ; # _R. J. Mathar_, Mar 23 2015
%t f[n_, r_, s_] := f[n, r, s] = Module[{resu, m, a, b}, Which[n <= 0, 0, s == 1, StirlingS2[n, r], r == 1, StirlingS2[n, s], True, resu = s*f[n - 1, r - 1, s] + r*f[n - 1, r, s - 1] + r*s*f[n - 1, r, s]; Do[resu += Binomial[n - 2, m]*(b*(r - a) + a*(s - b))*f[m, a, b]*f[-m + n - 1, r - a, s - b], {m, n}, {a, r - 1}, {b, s - 1}]; resu]];
%t a[n_] := Module[{b = 0}, Do[b += r*s*f[n, r, s], {r, n}, {s, n}]; b];
%t Array[a, 16] (* _Jean-François Alcover_, Nov 23 2017, after _R. J. Mathar_ *)
%o (Sage)
%o @cached_function
%o def F(n, r, s):
%o if n <= 0: return 0
%o if s == 1: return stirling_number2(n, r)
%o if r == 1: return stirling_number2(n, s)
%o ret = s*F(n-1,r-1,s)+r*F(n-1,r,s-1)+r*s*F(n-1,r,s)
%o for m in (1..n-2):
%o for a in (1..r-1):
%o for b in (1..s-1):
%o ret += binomial(n-2,m)*(a*(s-b)+b*(r-a))*F(m,a,b)*F(n-m-1,r-a,s-b)
%o return ret
%o @cached_function
%o def A256033(n):
%o a = 0
%o for r in (1..n):
%o for s in (1..n):
%o a += r*s*F(n, r, s)
%o return a
%o [A256033(n) for n in (1..9)] # _Peter Luschny_, Jan 17 2016
%Y Cf. A060639, A256034.
%K nonn
%O 1,2
%A _N. J. A. Sloane_, Mar 14 2015