Modified Stars and Bars

Revision en1, by Virtual_Contestant, 2021-04-05 11:06:01

We know that the solution of x1 + x2 + x3 .. xk = n, where xi >= 0 is given by nCr(n + k — 1, n). I was trying to solve a problem in which I had the constraints that all the xi were bounded by ai meaning (xi >= 0 and xi <= ai for all i from 1 to k). I know how to solve this problem using hand (by findind the coefficients and all) but how do I write a code for it or is it possible to write a code for it?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Virtual_Contestant 2021-04-05 11:06:01 435 Initial revision (published)