# Way to compute Stirling numbers of the second kind from a multiset

I was wondering what algorithm would compute

S(n, k {occurences of each element})


Where

S(6, 3, {1, 2, 3} )


would give the total number of ways a set with 6 elements in which 3 are the same element and a different 2 are another element (and 1 is its unique element) could be split into 3 non-empty sets, ignoring permutations.

This is basically the extension of Stirling numbers of the second kind to deal with multisets.

## migrated from scicomp.stackexchange.comDec 31 '14 at 15:57

This question came from our site for scientists using computers to solve scientific problems.

• What is the problem that you are trying to solve? – Kirill Dec 30 '14 at 7:24
• How to compute number of unique ways to split a multiset into a given number of non-empty subsets. Ignore permutations, and treat all repeated elements as identical. – robertkin Dec 30 '14 at 21:18
• No, that's not my question. What is the actual problem that gave rise to this question? Why is this particular combinatorics question of interest? – Kirill Dec 30 '14 at 22:02
• I was simply learning about stirling numbers and was thinking about how to expand it to deal with repeated elements. There's no general formula for it, so I was looking for an algorithm to do so – robertkin Dec 31 '14 at 1:38
• Interesting question, but probably better suited for the math stackexchange. – Nick Alger Dec 31 '14 at 7:48