I have the following equation
$$x_1+x_2+x_3+x_4+x_5+...+x_n= M$$
and constraints is all elements should in between $1\leq x_i\leq k$. how to find the solution for the above equation.
I can easily found the number of solution of equation where $1\leq x_i$
Number of Solution: ${M-1 \choose n-1}$
Number of solution of equation where $k+1\leq x_i$
Number of Solution: ${M-n*(k+1)-1 \choose n-1}$.
But how to find the solution which satisfy the required criteria ?
n
,m
andk
can be any integer value , quite be large also in range – Marvel May 10 '17 at 09:22nk
? – Marvel May 10 '17 at 09:28N=50
,K=300
andM=1000
– Marvel May 10 '17 at 09:38