NOTE: if we divide X!/a! we will have (X-a) elements

To Prove: (X-a) + (Z-c) + (b-Y) is the shortest list one can find or in other words (X-a) + (Z-c) + (b-Y) <= (X-p) + (Z-q) + (r-Y) for any p,q,r in permutation(a,b,c) Proof: From the above equation since b > Y and Z > c, r should be equal to either a or b. If r = b then the solution is trivial

If r = a then we get (X-a) + (Z-c) + (b-Y) ?<= (X-b) + (Z-c) + (a-Y) canceling terms -a - c + b ?<= -b -c + a -a + b ?<= -b + a ====> YES since a > b we see that r = a is not the smallest list so r = b

Similarly we can also show that (X-a) + (Z-c) + (b-Y) <= (X-a) + (Y-c) + (b-Z)