There's an equation: 1a + 2b + 3c + 4d ... + 9i = 9
Constraints: 1 <= a + b + c + ... + i <= 104
where a,b,..,i are non-negative integers and each of the integers have a particular range.
For example: 1 <= a <= 5, 2 <= b <= 3, and so on.
I need to find out the number of different sets of values of those variables, or simply, the number of ways of solving that equation.
There's a recursive method of solving this, but that's very slow. I'm unable to think of a way to solve this efficiently under the given constraint.