I don't have the required skills to solve this problem. I would appreciate it, if anyone could help me: You have k boxes, N balls and every box can contain a maximum of t balls, where t is for every box different. The boxes are distinguishable, the balls not. It is also possible that a box contains nothing. How many different solutions are possible? I can compute all solutions, but the condition is missing. Is it possible to subtract all wrong solutions?
1 Answers
So far as I know, there is no closed form solution for this general problem.
Let me change the notation: you have $n$ balls, $m$ boxes, and box $k$ (for $k=1,\ldots,m$) has a maximum capacity of $t_k$. Let $[m]^k$ denote the family of subsets of $[m]=\{1,\ldots,m\}$ of cardinality $k$. Then a combination of stars and bars and the inclusion-exclusion principle allow one to deduce that there are
$$\sum_{k=0}^m(-1)^k\sum_{S\in[m]^k}\binom{n+m-1-\sum\limits_{i\in S}(t_i+1)}{m-1}=\sum_{k=0}^m(-1)^k\sum_{S\subseteq[m]^k}\binom{n+m-k-1-\sum\limits_{i\in S}t_i}{m-1}$$
solutions. In this answer to essentially the same problem with very different notation I gave more of the details of the reasoning; this answer gives full details for a simpler problem with specific numbers.
In this answer Marc van Leeuwen deals with exactly your problem, starting with the simpler case in which all of the limits $t_k$ are equal using an approach via generating functions.

- 616,228
-
@BrianMScott: Thanks for providing an answer with references to a lot of related problems. (+1) – Markus Scheuer Sep 07 '15 at 06:30