Variables:
$c$ = cost to enter
$d$ = amount of dollars remaining
We consider the function $f(d)$, whose value is the chance of losing if you have $d$ dollars remaining.
The answer to this question consists of three approximations:
1) We designate a really high value $w$, the sure-win value. We assume that $f(x) = 0$ for $x > w$ (or $f(x) = \left(\frac{c-1}{c}\right)^x$, if you wanna be that precise).
2) Starting with $f(0)$, we recursively compute the value of $f(d)$, in terms of $f(x)$ for $x>d$.
3) Once we have computed $f(d)$ for all $0\leq d\leq w$ in terms of $f(x)$ for $x>d$, then we can go back and compute the exact value of $f(d)$ for $0\leq d\leq w$.
The answer to OP's question will be $f(10^9)$. This will be a lower bound on the chance of losing; the exact answer can be approximated by either
- making $w$ arbitrarily high, or
- once the curve direction for $f(x)$ is clear from the first iteration of the above steps, estimating $f(x)$ for $x > w$ (instead of setting $f(x)$ to be =0) will give a more precise answer for the second iteration. Repeatedly iterating this process with new approximations for $f(x)$ should yield an answer of arbitrarily high precision.
For simplicity, we allow to play as long as a player has a non-negative amount of money remaining; the player is broke when he has a negative amount of money remaining. This is clearly equivalent to the standard setup.
Step 1:
Recall: $f(x)$ = chance of eventually losing everything if you start with $x$ dollars; so $f(x) = 1$ for $x<0$.
Define the function $g(x) = \frac{1}{2}f(x+1) + \frac{1}{4}f(x+2) + \frac{1}{8}f(x+4) + ...$ to be the expected value of losing if you have $x$ dollars after having payed for one round. Since we assume $f(x)$ has a closed form for $x>w$, then this function can be written as a finite sum.
Step 2: Using the fact that $f(x) = g(x-c)$, we can compute $f(x)$ for small values. For example, if $b=\lceil$log$_2c\rceil$ = the number of heads you need to get at least $c$ dollars from the pot, then $f(0)$ becomes:
$$f(0) = g(-c) = (1 - \frac{1}{2^b}) + \frac{1}{2^{b+1}}f(2^b-c) + \frac{1}{2^{b+2}}f(2^{b+1}-c) + \cdots$$
We recursively compute $f(x)$ for all $0 < x < w$. Any time in the expression for $f(x)$ there occurs $f(y)$ for $y<x$, then since we have computed $f(x)$ in terms of higher terms, we can simply replace those occurrences with the corresponding higher terms (starting with the lowest $y$). In terms of statistics, this can be thought of as a random walk, with a huge $w$ x $w$ transition matrix.
Step 3: In the end, we will have computed $f(w-1)$, which will be in terms of $f(x)$ for $x \geq w$, so will have an exact value. We can then use the expressions we got in Step 2 to compute $f(x)$ for repeatedly decreasing values of $x$.
I am sure this can be explained a lot more cleanly; but, I was not able to get an exact value without approximation.
Let $e_k$ be the expected number of bets starting from $k$ dollars. Then
\begin{align}
e_{k}&=1+pe_{k+1}+qe_{k-1},\qquad k=1,2,\dots,n-1\\
e_n&=0,\\
e_0&=1+e_1.
\end{align}
The first equation can be written as
$$
e_{k+1}-e_k=(q/p)(e_k-e_{k-1})-1/p
$$
Applying this over and over, you get
\begin{align}
e_{k+1}-e_k
&=(q/p)^k(e_1-e_0)-\sum_{i=0}^{k-1}(q^i/p^{i+1})
\\&=(q/p)^k(-1)-\frac{1-(q/p)^k}{p-q}
\\e_{k+1}-e_k
&=(q/p)^k\frac{2q}{p-q}-\frac1{p-q}
\tag{*}
\end{align}
Now, take equation $(*)$ and sum both sides from $k=1$ to $n-1$. The left hand telescopes to $e_n-e_1=-e_1$, and the right hand side can be simplified. This lets you solve for $e_1$. You can then sum $(*)$ from $k=1$ to $m-1$ to get a formula for $e_m$, for all $m$. The result is
$$
-e_1=\frac{2q}{p-q}\cdot\frac{(q/p)^n-q/p}{q/p-1}-\frac{n-1}{p-q}
$$
$$
e_1=\frac{n-1}{p-q}+2\cdot \frac{(q/p)^{n+1}-(q/p)^2}{(q/p-1)^2}
$$
$$
\bbox[5px, #ddddef, border: solid black 2px]
{e_m=\frac{n-m}{p-q}+2\cdot \frac{(q/p)^{n+1}-(q/p)^{m+1}}{(q/p-1)^2}}
$$
This is only valid for $m\ge 1$, but $e_0$ is simply $1+e_1$.
If $z_k$ is the expected number of returns to zero starting from $k$, then you instead have
\begin{align}
z_{k}&=pz_{k+1}+qz_{k-1},\qquad k=1,2,\dots,n-1\\
z_n&=0,\\
z_0&=1+z_1.
\end{align}
We are counting the number of times you move from $0$ to $1$, which is the same as the number of visits to zero. This is even easier to solve. You instead have
$$
z_{k+1}-z_k=(q/p)^k(z_1-z_0)=(q/p)^k(-1)\tag{**}
$$
Therefore, using a telescopic sum with $(**)$,
$$
-z_1=-\sum_{k=1}^{n-1}(q/p)^k\implies z_1=\frac{(q/p)^n-q/p}{q/p-1}
$$
$$
z_m-z_1=-\sum_{k=1}^{m-1}(q/p)^k\implies \bbox[5px, #ddddef, border: solid black 2px]
{z_m=\frac{(q/p)^n-(q/p)^m}{q/p-1}}
$$
Again, this assumes $m\ge 0$.
Let $B_{n,m}$ be the probability that starting with $\$m$, you hit $\$0$ before you hit $\$n$. This is the classical gambler's ruin problem, whose solution is well known to be
$$
B_{n,m} = \frac{(q/p)^n-(q/p)^m}{(q/p)^n-1}
$$
Letting $N$ be the number of times you reach zero before reaching $n$, then
$$
\bbox[5px, #ddddef, border: solid black 2px]
{
P(N=k)=
\begin{cases}
B_{n,m}\cdot B_{n,1}^{k-1}\cdot (1-B_{n,1}) & k>0 \\
1-B_{n,m} & k = 0
\end{cases}
}
$$
Best Answer
I do not see an easy approach, so I tried a simulation in R using the following code, which sees whether you lose in the first million games, repeated $100000$ times:
It produced the result
0.00021
, suggesting that the simulation lost $99979$ times but failed to lose $21$ times. Of those $21$ cases, after a million games the surviving bankrolls were in the range $68183$ to $17492689$ in this particular simulation, so there was a net average gain.Obviously there is uncertainty associated with any simulation and there may be further losses as the number of games increases further, but this suggests the probability of not losing overall is extremely small. About $82\%$ of losses seemed to have happened in the first twenty games and about $97\%$ of losses in the first hundred games, so the unbounded potential gains do not often offset the price of playing repeated games.