Given positive real numbers $a_1,a_2,\dots,a_n$ and another positive real number $b$, solve the $n$ integer-valued parameter (denoted by $k_1,k_2,\dots,k_n$) equation
$k_1a_1+k_2a_2+\dots+k_na_n \leq b$.
But the task is to determine, how many distinct ordered tuples of integer values $(k_1,k_2,\dots,k_n)$ solve above inequality. How I would do:
Let $C_n(a_1,\dots,a_n,b)$ be the number of solutions of this equation. Then I can derive the following recursion relation:
$C_{n}(a_1,\dots,a_n,b) = \sum_{k_n=0}^{floor(b/a_n)} C_{n-1}(a_1,\dots,a_{n-1},b-k_na_n)$ (by summing up all admissible subtractions of the last left hand side term $k_na_n$ and formulate them as a lower-dimensional sub-problem)
However, if I implement this recursion for high values of $b$ and/or high $n$, the computation time might be very high. Is there a method to count the number of distinct solutions more efficiently without sacrificing the accuracy of the result (Also I think about Monte-Carlo method, but accuracy is also poor if I do not so much iteration steps)?
Any help would be greatly appreciated.