login
Number of partitions of an n-set with an even number of blocks of size 1.
9

%I #19 May 11 2020 17:23:48

%S 0,2,1,11,21,117,428,2172,10727,59393,345335,2143825,14038324,

%T 96834090,700715993,5305041715,41910528809,344714251149,2945819805408,

%U 26107419715988,239556359980239,2272364911439153,22252173805170347,224666265799310801,2335958333831561032

%N Number of partitions of an n-set with an even number of blocks of size 1.

%H Alois P. Heinz, <a href="/A111724/b111724.txt">Table of n, a(n) for n = 1..576</a>

%F E.g.f.: cosh(x)*exp(exp(x)-1-x).

%F More generally, e.g.f. for number of partitions of an n-set with an even number of blocks of size k is cosh(x^k/k!)*exp(exp(x)-1-x^k/k!).

%p b:= proc(n, t) option remember; `if`(n=0, t, add(b(n-j,

%p `if`(j=1, 1-t, t))*binomial(n-1, j-1), j=1..n))

%p end:

%p a:= n-> b(n, 1):

%p seq(a(n), n=1..30); # _Alois P. Heinz_, May 10 2016

%t Rest[ Range[0, 24]! CoefficientList[ Series[ Cosh[x]Exp[Exp[x] - 1 - x], {x, 0, 23}], x]] (* _Robert G. Wilson v_ *)

%o (Python)

%o from sympy.core.cache import cacheit

%o from sympy import binomial

%o @cacheit

%o def b(n, t): return t if n==0 else sum(b(n - j, (1 - t if j==1 else t))*binomial(n - 1, j - 1) for j in range(1, n + 1))

%o def a(n): return b(n, 1)

%o print([a(n) for n in range(1, 51)]) # _Indranil Ghosh_, Aug 10 2017

%Y Cf. A097514, A113235, A063083, A062282, A111723, A111752, A111753.

%K easy,nonn

%O 1,2

%A _Vladeta Jovovic_, Nov 17 2005

%E More terms from _Robert G. Wilson v_, Nov 22 2005