# Applying a Math Formula in a more elegant way (maybe a recursive call would do the trick)

This is my first post in Math section. I've been redirected here from StackOverflow, users from there suggested me to ask here.

This could appear a little bit complex at first sight but afterall there's nothing special.

We are in a poker touranment, there are 'n' players, each one has a stack of chips. There are only 'p' places to be paid at the end of the tournament.

We want to apply a math formula to convert the actual players' stacks into money. So we call 'equity' the probability of each player to finish the tournament in each paid place.

I'll hypothesize there are 4 players (P1,P2,P3,P4) and 3 paid places:

Equity on 1st place is:

$eq1_1 = ($P1_stack / $total_chips);$eq2_1 = ($P2_stack /$total_chips);
$eq3_1 = ($P3_stack / $total_chips);$eq4_1 = ($P4_stack /$total_chips);


Equity on 2nd place:

To calculate the equity of each player on 2nd place we have to hypothesize that each one of the remanent players has won the first prize, subtract his(the winner's) stack from the total chips, divide the player 2 chips by the remanent chips, and multiply this number by the probability(equity on 1st prize of the player who won the 1st prize). I know, brains' explosions have been reported here.

//-if P2 wins the tornament

-