# Combinatorics using constraints and ordered set

How would you find the number of combinations for a set of elements, where the elements have minimum and maximum values and the set is in lexicographic order.

As an example:

$a+b+c+d+e=635$, which may be...

${[0-90] + [1-120] + [50-150] + [20-200] + [30-250] = 635}$

where elements b, c, d and e must be greater than the element that precedes it. As in, "b" must be greater than "a" by at least one, etc.

I have tried using inclusion-exclusion principle but I'm having trouble getting the correct answer. If I use ${639\choose4}$ and inclusion-exclusion, I get the number of combinations obeying the max/min constraints, but including those not in lexicographic order. If I use ${150\choose5}$, I have a number of combinations in order, but includes combinations that do not sum to 635 or that obey all constraints.

Thank you very much for all your help!

-

$$\sum_{a=0}^{90}\sum_{b=a+1}^{120}\sum_{c=\max(b+1,50)}^{150}\sum_{d=\max(c+1,20)}^{200}x$$ where $x=1$ if $\max(d+1,30)\le635-a-b-c-d\le250$, $x=0$ otherwise. Shouldn't be so hard to program a computer to do that sum.
Since you have tried i-e two different ways without success, what makes you think i-e would be easier or faster? Can you use i-e for a much simpler problem, say, $a+b=100$, $10\le a\le 40$, $b\ge a+1$, $20\le b\le85$? If you can figure out how to use i-e to do that one, I bet you can figure out how to use it for the original problem; and if you can't do the simpler problem using i-e, what hope is there of using it for the original problem? –  Gerry Myerson Jun 18 '12 at 4:23