1
$\begingroup$

N balls and how many buckets you want. You want to put the N balls into buckets. How many buckets options are there?

For example, (N=)4 balls can be put in the following ways:

  • {1,1,1,1} - 1 ball into each bucket
  • {1,1,2} - 2 buckets with 1 ball and 1 bucket with 2 balls
  • {2,2} - 2 buckets with 2 balls
  • {1,3} - 1 bucket with 1 ball and 1 bucket with 3 balls.
  • {4} - 1 bucket with all 4 balls.

So the answer here is 5 different bucket options.

$\endgroup$
  • 2
    $\begingroup$ Take a look here: en.wikipedia.org/wiki/Partition_(number_theory) $\endgroup$ – Vitaly B Nov 29 '13 at 22:00
  • $\begingroup$ It's like asking for the number of all possible combinations of numbers that add up to N (order doesn't matter). $\endgroup$ – AlikElzin-kilaka Nov 29 '13 at 22:06
  • $\begingroup$ @VitalyB, your comment sounds like an answer - p(n), right? $\endgroup$ – AlikElzin-kilaka Nov 29 '13 at 22:20
  • $\begingroup$ Yes, in the general case the answer is given by $p(n)$ $\endgroup$ – Vitaly B Nov 29 '13 at 22:34
  • $\begingroup$ You also need to have at least one ball in each bucket, right? $\endgroup$ – John Nov 29 '13 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.