Detailed problem statement can be found here Gambler's Ruin
General solution to the problem is;
$1- a_1 = a_1 \sum\limits_{i = 1}^{k-1} \left(\frac{1 - p}{p}\right)^i$
For a fair game of $p = \frac{1}{2}$, $a_1 = \frac{1}{k}$
and, for an unfair game of $p …


