= Solution
Let $h_k$ be the probability that the <simple random walk> started at $k$ hits $n$ before zero. The <first-step analysis> recurrence and <boundary conditions> are
$$
h_k=ph_{k+1}+qh_{k-1},
\qquad h_0=0,\quad h_n=1.
$$
If $p\ne q$, the <characteristic equation of a linear recurrence> has roots $1$ and $q/p$, so the boundary conditions give
$$
\boxed{h_m=\frac{1-(q/p)^m}{1-(q/p)^n}}.
$$
If $p=q=1/2$, the repeated root gives the limiting formula $\boxed{h_m=m/n}$. This is the <gambler's ruin> probability.
For a fixed integer stake $a\leq N$, the fact that $a$ divides $N!$ lets us measure Patricia's wealth in units of £$a$. She starts at $M=N!/a$ and succeeds upon reaching $2M$. The formula above factors as
$$
h_M=\frac{1-r^M}{1-r^{2M}}=\frac1{1+r^M},
\qquad r=\frac qp.
$$
For $p=18/37$, $r=19/18>1$, so this probability increases as $M$ decreases. She should therefore choose the largest stake, $\boxed{a=N}$. For $p=19/37$, $r=18/19<1$, so the probability increases as $M$ increases; she should choose the smallest stake, $\boxed{a=1}$.
Back to article page