Basic Examples (2)
Basic Examples
(2)
There are 15 set partitions of a five-element set into two subsets:
In[542]:=
ksp=[{a,b,c,d,e},2]
Out[542]=
{{{a},{b,c,d,e}},{{a,b},{c,d,e}},{{a,c,d,e},{b}},{{a,b,c},{d,e}},{{a,d,e},{b,c}},{{a,b,d,e},{c}},{{a,c},{b,d,e}},{{a,b,c,d},{e}},{{a,e},{b,c,d}},{{a,b,e},{c,d}},{{a,c,d},{b,e}},{{a,b,c,e},{d}},{{a,d},{b,c,e}},{{a,b,d},{c,e}},{{a,c,e},{b,d}}}
The number of such set partitions is given by a Stirling number of the second kind:
In[543]:=
Length@ksp
Out[543]=
15
In[544]:=
StirlingS2[5,2]
Out[544]=
15
Scope (1)
Scope
(1)