-2
$\begingroup$

This question already has an answer here:

Here is the problem:

Let M (the sum) be 10 and N (the number of numbers) be 4.

Some possible combinations are are (10, 0, 0, 0), (5, 3, 2, 0), (8, 1, 1, 0), (8, 2, 0, 0), (6, 2, 1, 1), etc.

How do I calculate the number of possible combinations?

Thanks for the help.

$\endgroup$

marked as duplicate by Claude Leibovici, user91500, Shailesh, RGS, John B Nov 23 '16 at 10:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Do you know what partitions are? $\endgroup$ – Saketh Malyala Nov 23 '16 at 1:15
  • 6
    $\begingroup$ This is a standard application of a stars-and-bars computation. $\endgroup$ – hardmath Nov 23 '16 at 1:24
  • $\begingroup$ Just had a quick read about it from: en.wikipedia.org/wiki/…, but I am unsure how to apply the formula $\endgroup$ – paperpin Nov 23 '16 at 1:25
  • $\begingroup$ The link I gave you is to a previous Question at Math.SE about how to apply its logic. $\endgroup$ – hardmath Nov 23 '16 at 1:26
  • $\begingroup$ @SakethMalyala: You ask about (integer) partitions, in which the order of summands is ignored, but I have interpreted the problem as concerning compositions, in which order of summands matters. We may get some clarification from the OP. $\endgroup$ – hardmath Nov 23 '16 at 1:36
0
$\begingroup$

As covered in the previous Question as well as the Wikipedia article, the number of such summations (order is important, so weak compositions rather than partitions) is $\binom{M+N-1}{N-1}$.


The example $M=10$ and $N=4$ of the OP then yields $\binom{13}{3} = 286$.

If instead we wanted to disregard order of summands, this is an overcount (since $6 + 1 + 1 + 0 = 0 + 1 + 1 + 6$, etc.). The number of integer partitions of $10$ with at most $4$ parts (zeros omitted, or padded out with zeros to give exactly four summands) is only $23$.

One can ask the Maxima Online Algebra Calculator to find this with the command:

length(integer_partitions(10,4));
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.