Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$x_1,x_2,...,x_n$ are integer numbers in the range [0,B-1]. Count the number of solution for $x_1+x_2+...+x_n=k$.

I know this problem is similar to the one here Number of ways of partitioning a sum into ordered non-negative summands

But now there is constraint on the range of $x_i$. In the problem text it gives a hint to use principle of inclusion and exclusion. Does anyone have a clue?

share|cite|improve this question

marked as duplicate by Brian M. Scott, Martin, Amzoti, vonbrand, tomasz May 17 '13 at 20:49

This question was marked as an exact duplicate of an existing question.

@BrianM.Scott I don't see how the first question you linked is related, but the second is essentially the same, so I'll vote to close. – tomasz May 17 '13 at 20:49
@tomasz: They’re all three essentially the same question: how many solutions in non-negative integers are there to $\sum_{k=1}^mx_k=n$ subject to the constraint that each $x_k\le b$? – Brian M. Scott May 17 '13 at 20:53
@BrianM.Scott: I see now. You're right. :) – tomasz May 17 '13 at 21:45

Browse other questions tagged or ask your own question.