Possible Duplicate:
How to distribute $k$ distinct items into $r$ distinct groups with each groups receiving $a (=k-n)$ prizes at most?

How many ways you can use to put N books on H shelves, but the shelf's must contain not more than X books? I would like to solve it by composition (number theory)..but nothing.. Please help me, thanks a lot.


marked as duplicate by Quixotic, Bill Cook, Asaf Karagila, J. M. is a poor mathematician, Zev Chonoles Nov 10 '11 at 3:30

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$ But all the books are the same! $\endgroup$ – Lu Vue Nov 9 '11 at 17:41
  • $\begingroup$ Then please update the question accordingly as they are different problems. $\endgroup$ – Quixotic Nov 9 '11 at 18:17

Let $a_i$ be the number of books place on shelf $i$, $i=1,2,\dots,H$. Then you want the number of solutions of $$a_1+a_2+\cdots+a_H=N$$ with each $a_i$ an integer satisfying $0\le a_i\le X$. That question has come up multiple times on this site. Let's both try searching the site to see if we can find one of those previous appearances.


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