$x_1 + x_2 + ... + x_n = k$
where each $x_i$ can have some value between $0$ and $10$ (we might have $0\leq x_1\leq 7$ and we might have $0\leq x_2\leq 9$ and so on...)
How many nonnegative integer solutions are there to an equation like this, where each $x_i$ can take on any of the values in its range restrictions?
Is Mick A's answer applicable to this from the following? Number of solutions to equation, range restrictions per variable
If so, how would Mick A's answer be extended for equations of arbitrary lengths of the left-hand side? How could this be solved for programmatically?
EDIT: My thoughts are that we calculate $S$ and then subtract $S_1, S_2, ..., S_n$ from it, after which we add all intersections $S_1 \cap S_2, ...$ and then we subtract all "three-way intersections" $S_1 \cap S_2 \cap S_3, ... $ and then we add all the "four-way intersections" $S_1 \cap S_2 \cap S_3 \cap S_4,...$ and then we subtract all the "five-way intersections" etc...
Is this a correct approach?