# Is there a formula to get the total wins from odds combination?

Here is the problem: given a set of bets, how can I calculate the maximum possible wins of all combinations without looping through them?

I know how to get the number of combinations ($$\frac{n!}{r!(n - r)!}$$) and I know how to get the powerset, so all the single combinations.

In order to calculate the total possible wins, I am currently looping through all the combinations, multiplying the odds together and then adding them all to the total.

As you know, though, combinations add up pretty quickly as I add more bets, so I will soon looping through thousands of combinations and my program slows down.

Now, before I start to optimise those loops and improve the UX, if there was a mathematical formula to calculate the max possible wins, the looping problems will instantly vanish.

I have searched extensively, but I couldn't find anything. I might be lacking the proper mathematical terminology to actually find the answer I am looking for. But this looks like something mathematicians would have already solved, probably in different fields and with a specific name that I can't find.

For this example, I will assume all stakes are 1, so it's easier to handle.

3 bets with odds: 1,40 | 1,45 | 1,55

7 combinations (technically there is another combination where no bets are chosen, but we can skip that, because it wouldn't add anything to the sum):

1,4
1,45
1,55
1,4*1,45
1,4*1,55
1,45*1,55
1,4*1,45*1,55


If you round each calculation to two decimals, you get 14,00 (otherwise, 13,99).

Is there a formula to get to that result without looping through the powerset and calculating everything sequentially?