# How many ways can M identical objects be divided into N groups?

We have M indistinguishable objects and will divide them into N indistinguishable groups. How many ways can this be done?

Many might believe that this is a Stars and Bars type question, but it is more complex. Consider for example, putting 9 objects (M=9) in 4 piles (N=4), the distinct arrangements are:

6 1 1 1

5 2 1 1

4 3 1 1

4 2 2 1

3 3 2 1

3 2 2 2

These are the only 6 arrangements possible. The classic stars and bars solution is C(m-1,n-1) = C(8,3) = 56, drastically overstating them because of duplicate counting.

I get the feeling that the solution is a combination of combinations but I can't figure it out.

How can we generalize the solution?

• Look up "partitions of numbers", e.g. this Wikipedia page – bof Jan 5 '14 at 5:44
• The short wrong answer is "you can't". The longer answer is not in fact an answer, but a question: "How much complex analysis are you willing to learn to get an answer to this question?" If your response is "up to and including the circle method" then congratulations, you get an unwieldy and slowly-converging infinite summation formula. If your response is "up to and including modern research in harmonic Maass forms", then (1) wow and (2) for your devotion you will be rewarded with a mildly unwieldy but at least finite formula. [tl;dr you've stumbled across a problem that is very hard.] – Eric Stucky Jan 5 '14 at 5:55
• If you get no responses I guess I could turn that into an answer but there are probably partial results that you can get along the way and I don't know any of them-- I just happen to have heard Ken Ono several times in the last few years so I know a little bit about this problem. – Eric Stucky Jan 5 '14 at 5:56
• As Eric Stucky says, this is a very deep question. No simple relationship is known between your $p(m,n)$ and other well-studied mathematical quantities such as binomial coefficients. There is of course a simple algorithm that can quickly calculate $p(m,n)$ for given $m$ and $n$. But to get the value in general in closed form is very difficult. Here is a related question I asked recently that may amuse you: math.stackexchange.com/questions/620987/… – MJD Jan 5 '14 at 6:32
• Thanks very much for asking this question. I came across it today as I was doing my homework, and became depressed that I couldn't figure it out ("wow, I suck at basic combinatorics"). Somehow, the fact that it isn't a basic question at all is some sort of a relief. Should have searched M.SE earlier! – user89 Oct 13 '14 at 6:08