simple question about combinations

Hello,

I have an issue with my little experiment :) it's working but I'm trying to optimize it... to reduce number of operations... and similar things...

It's hard to explain, but let's say that it is similar to the betting systems... when you play system 10 of 20 (meaning you have to win at least 10 of 20 games to get paid... if more win, more you get paid :) ) System 10 of 20 have 184756 combinations (without repetition, and order is not important) and that's a really big number... Let's say that we have 20 variables and each one of them have some value $\displaystyle (x_1 = 10, x_2 = 20, .... x_{20} = 5)$ if i play system 10 of 20 (or any other) and i win 14 of those 20 games... that means from 184756 combinations, i have winning 1001 combination... and then comes problem...

I have to calculate each of those 1001 combinations and then add them all... I'm not interested in the values of every one of those 1001 combination, just total value at the end...

I have created file with all of the combinations 2-20, 3-20, .... 19-20 and it's really really big file (with couple of "for loops") ... but it's necessary so my program know how and what to multiply .... $\displaystyle (x_1 * x_2 * x_3...* x_{10}, .....)$ depending on let's say system....

I tried to optimize number of summations and multiplications, but any bigger system from 5 it's getting really messy....

(for smaller it's ok.... like 3-5...

$\displaystyle x_1 [x_2 (x_3 + x_4 + x_5) +x_3 (x_4 + x_5) + x_4 x_5] + x_2 (x_3 (x_4 + x_5)) + x_3 x_4 x_5 $

with this i reduced calculation to from 9 to 8 sumations and from 20 to 6 multiplications... but for any bigger then 5-10 :( :( :( i got headache hehehehehehe )

So I wonder, is there any kind of formula to get that final result or i have to do it step by step... and go through all of those combinations?

Thanks,

any kind of help is really really welcome :D

P.S. Sorry if I put this at the wrong place... i haven't been here for a while :D

Re: simple question about combinations

You seem to be beating around the bush regarding details of your calculations and that makes it difficult to see if there are any patterns that collapse into a nice expression. Without more detail (i.e. how you arrived at the 3-5 sum), it is difficult to help you. Have you considered using matrices?