Probability Riddle

I was told a puzzle recently, and I can't figure out how to solve it. It went like this:

You are a prisoner. You play a game with the guard many times a day. This game has a unique probability $p$ for you to win, and it is the same every time you play. Each time you win, you "gain a life." Each time you lose, you "lose a life." You begin with 1 life. What does $p$ need to equal for you to stay alive for a long time (many years with you playing multiple times a day)?

I know the probability will have to be greater than 0.5, but how much greater than that does it need to be for you to be sure you'll live a long life?

• There is no answer less than "1". If there is any chance at all you will lose, then you could lose on the first term. – user247327 Apr 5 '16 at 1:47

This is a form of the Gambler's Ruin problem. Here is a pdf with an analysis of the problem. If you go to the bottom of page 2, you will see that the probability of surviving indefinitely, given that $p > 0.5$, is $2-1/p$.
• Thanks for the link @Flounderer. I don't see anywhere the $2 -1/p$ equation you referenced though. I see a $1-q/p$. Also, is there a certain probability of you winning each game that will maximize the odds of you becoming infinitely rich? Is it just intuitive and the answer is $p=0.99$? – BrianW Apr 5 '16 at 12:31
• In the paper, $q$ is defined to be $1-p$, so $1-q/p=1-(1-p)/p = 2-1/p$. The probability of becoming infinitely rich is maximised when $p=1$. Otherwise, there is a positive probability of going broke in the long run. – Flounderer Apr 5 '16 at 21:45