login
Number of partitions of [n] such that the number of blocks containing only odd elements equals the number of blocks containing only even elements.
4

%I #18 Oct 20 2023 08:52:02

%S 1,0,2,2,9,23,99,353,1778,7927,45273,238797,1526331,9215950,65020448,

%T 439742641,3388075807,25270974635,210763775071,1713657668021,

%U 15359474721088,134902169999841,1291589459223627,12165062702520422,123780591852786693,1242763745129587332

%N Number of partitions of [n] such that the number of blocks containing only odd elements equals the number of blocks containing only even elements.

%H Alois P. Heinz, <a href="/A363451/b363451.txt">Table of n, a(n) for n = 0..250</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Partition_of_a_set">Partition of a set</a>

%e a(0) = 1: () the empty partition.

%e a(1) = 0.

%e a(2) = 2: 12, 1|2.

%e a(3) = 2: 123, 13|2.

%e a(4) = 9: 1234, 12|34, 12|3|4, 13|24, 14|23, 1|23|4, 14|2|3, 1|2|34, 1|2|3|4.

%e a(5) = 23: 12345, 123|45, 123|4|5, 125|34, 12|345, 125|3|4, 12|35|4, 134|25, 134|2|5, 135|24, 13|25|4, 13|2|45, 13|2|4|5, 145|23, 14|235, 15|23|4, 1|235|4, 145|2|3, 14|2|35, 15|2|34, 1|2|345, 15|2|3|4, 1|2|35|4.

%p b:= proc(n, x, y, m) option remember; `if`(n=0, `if`(x=y, 1, 0),

%p `if`(x+m>0, b(n-1, y, x, m)*(x+m), 0)+b(n-1, y, x+1, m)+

%p `if`(y>0, b(n-1, y-1, x, m+1)*y, 0))

%p end:

%p a:= n-> b(n, 0$3):

%p seq(a(n), n=0..28);

%t b[n_, x_, y_, m_] := b[n, x, y, m] = If[n == 0, If[x == y, 1, 0], If[x + m > 0, b[n - 1, y, x, m]*(x + m), 0] + b[n - 1, y, x + 1, m] + If[y > 0, b[n - 1, y - 1, x, m + 1]*y, 0]];

%t a[n_] := b[n, 0, 0, 0];

%t Table[a[n], {n, 0, 28}] (* _Jean-François Alcover_, Oct 20 2023, after _Alois P. Heinz_ *)

%Y Cf. A000110, A363434, A363435, A363454.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Jun 02 2023