Learn R Programming

kStatistics (version 2.0)

nStirling2: Stirling number of second kind

Description

Compute the Stirling number of the second kind.

Usage

nStirling2( n, k )

Arguments

n

integer

k

integer [ k <= n ]

Value

integer

Stirling number of the second kind

Details

The Stirling numbers of the second kind, written S(n,k), count the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. For example if the set is [a,b,c,d], the partitions in 2 blocks are: [[a], [bcd]], [[b], [acd]], [[c], [abd]], [[d],[abc]] with cardinalities (1,3) and [ab, cd], [ac, bd], [ad, bc] with cardinalities (2,2). Then S(4,2) is 7. S(4,2) is also the number of set partitions of class the partition of 4 in two parts.

References

Stanley, R. P. Enumerative combinatorics. Vol.1. II edition. Cambridge Studies in Advanced Mathematics, 49. Cambridge University Press, Cambridge, 2012.

See Also

mkmSet, umSet, mCoeff, intPart, countP, df

Examples

Run this code
# NOT RUN {
# Generate the number of ways to partition a set of 6 objects into 2 non-empty subsets
nStirling2(6,2) 

# }

Run the code above in your browser using DataLab