# Project Euler #232: The Race

# Project Euler #232: The Race

Wdbceg + 0 comments The query q and denominator q being the same letter is really confusing !!

randhirsingh051 + 0 comments Why is this in the easy section? lol

chiken + 5 comments Maybe I'm a fool but I am completely lost on how the answer is 1/3.

kmcshane + 0 comments This should help: https://www.geeksforgeeks.org/modular-division/

kevinngonyc + 1 comment The way I thought about it was this:

Since the winning score is 1, Player 2 gains no advantage to flipping multiple times and therefore each turn, his/her probability of winning is simply 0.5.

The probability of Player 2 winning on his/her first turn is 0.5 * 0.5 since Player 1 has to miss with probability 0.5 AND Player 2 has to hit with probability 0.5

The probability of Player 2 winning on his/her second turn is 0.5 * 0.5 * 0.5 * 0.5 since Player 1 has to miss, then Player 2 has to miss, then Player 1 has to miss, then Player 2 has to hit. The pattern continues for an arbitrary number of turns.

The probability of Player 2 winning on any of his/her turns is therefore the sum of the infinite sequence 1 / (2 ^ (2n + 2)) which is equal to 1/3.

Leo97 + 1 comment i cant understand how 1/(2^(2n+2)) equal to 1/3 ?

kevinngonyc + 0 comments Ah sorry I should clarify that the sequence I mentioned begins indexing at 0. The way I did it was with a simple program that performed a partial sum up to say the 1000th term since it converges. However this is just a geometric series: S = 1/4 + 1/16 + 1/64 + ... Dividing both sides by 4 you get S/4 = 1/16 + 1/64 + ... Subtracting the two equations you get 3S/4 = 1/4 or S = 1/3

AnasKhedr + 0 comments [deleted]AnasKhedr + 0 comments https://drive.google.com/file/d/1fMge5Hf5wvyj1BBGUjwsJBoMjD2KP_aK/view?usp=sharing

check this image, it the explanation but i don't know to to format a table here.

193J1A05I2 + 0 comments *yup dude me too..can anyone explain ??*

JimZer + 1 comment I managed to solve the problem on the Project Euler webpage. However my solution are decimals like: 0.33333333333 for the example given here (with 1 as input). How is it possible to recover the rational expression (fraction of integer a/b) from my result to then express it in the weird modulo formulation as asked in the problem statement? I'm confused

scott147 + 0 comments Me too!

nevans85_pro + 1 comment I wanted to ask how people are handling player two's decision as to how many coins to toss when n > 1. It seems that regardless of how many coins are used, the expected value of the result is the same since the points gained doubles with each additional coin and the probability of success is halved.

T | Probability | Score | E.V.

1 | 1/2 | 1 | 1/2

2 | 1/4 | 2 | 1/2

3 | 1/8 | 4 | 1/2

4 | 1/16 | 8 | 1/2

Should Player 2 use as many coins as possible to reach n in less turns or should P2 use 1 coin each time to maximize the chance of scoring any points? Or is the decision inconsequential as all decisions result in the same E.V?

dsgarg71 + 1 comment player 2 choose maximum probablity, which is dependent on player 1 turns. if player 2 needs 3 points , then player 1 has probablity of 1/8. any probablity better than 1/8 would be player 2 choice.

let's say it is 2 coins. each turn there is 1/4 chance of getting the 2 points. for 3 rounds, that means (1/4 * 3/4*1/4)*3 probablity, better than 1/8.

olivia_quinet + 0 comments I don't get your way of computing the probabilty for player 2...

Sort 14 Discussions, By:

Please Login in order to post a comment