So, I'm a programmer and yesterday I was at a job interview and I was asked the following question:
A six-sided die is rolled until the number 1 is thrown. What is the probability that the sum of all previous outcomes (including the last one) is odd?
I'm reasonably OK with probability, but this question had me stumped. How can I calculate this probability without knowing how many times the die was rolled? I would appreciate any ideas on the best way to approach this kind problem.
Thanks!
Let $p$ be the answer. $1-p$ is then the probability that the sum is even.
Consider the first toss. With probability $\frac 16$ you get a $1$, and the sum is sure to be odd. With probability $\frac 26$ you get an odd number other than $1$ and now you need an even sum in order to win. With probability $\frac 36$ you get an even number, which restarts the game.
Thus $$p=\frac 16 \times 1 +\frac 26\times (1-p)+\frac 36\times p\implies p=\frac 35$$