TITLE: What is $P$ of either Heads or Tails having a lead $\geq 10$ at some point during game of $300$ flips?
QUESTION [7 upvotes]: Question refers to $P$ of getting lead of at least $10$ at any point during a game, with game lasting only $300$ flips.
I tried to apply the formula given in an answer to a similar question 
here 
$P(X_n≥ (n+10/2))$
but that works out to summing $300 + 10$, and dividing by $2$ which = $155$.
Following from that previous answer, it would seem that the $P$ of a lead of $10$ or greater at some point in a $300$ flip Game would be only $.155$ ...and that does not fit with the results when
I simply use a simulator to repeatedly sample games of $300$ flips and count the times that a lead of at least 10 appears.
Is there something wrong in the way I am applying this formula? or is wrong for the question I am asking?

REPLY [2 votes]: With this  problem it  is a challenge  already to provide  a numerical
answer  that can  be  used  to check  the  results from  probabilistic
methods. This  can in fact be done,  and I will show  how.  Suppose we
have $n$ flips and we are looking to count outcomes where a lead of at
least $q$  was obtained at  some point.  The  idea is to use  a Markov
chain with states $T$ and  $A_p$ where $-(q-1)\le p\le q-1.$ The state
$A_p$ represents the  lead $p$ with the obvious  transition rules that
this  implies. Finally  $T$  is  an absorbing  state  where the  chain
remains once  a lead of  $q$ has been  seen.  We solve this  system of
equations and  obtain $T.$  We get for  the present problem  which has
$q=10$
$$\bbox[5px,border:2px solid #00A000]{
T(z) = {\frac {2{z}^{10}}{ \left( 2\,{z}^{10}-25\,{z}^{8}
+50\,{z}^{6}-35\,{z}^{4}+10\,{z}^{2}-1 \right)  
\left( 2\,z-1 \right) }}.}$$
It remains to compute
$$\frac{[z^{300}] T(z)}{2^{300}}.$$
Extracting the coefficient we get 
${ 1.9744763278096917789\times 10^{90}}$
which yields for the probability of having seen a lead of at least ten
at some point during $300$ flips the value
$$\bbox[5px,border:2px solid #00A000]{
0.96928888382356097067.}$$
Observe  that  we  used  the  Maple  series  command  to  extract  the
coefficient.   This can be  replaced if  desired by  converting $T(z)$
numerically into  a partial  fraction decomposition and  computing the
coefficients from a geometric series (I have tested this).
The Maple code  for this including an enumeration  routine to check
the result  from the  Markov chain,  is as follows.  We can  of course
solve for  $T$ manually but here  it has retained the  format from the
system of equations.

X :=
proc(q)
    option remember;
    local sys, pos, sol, eq;

    sys := [A[-(q-1)] = z * A[-(q-2)],
            A[q-1] = z * A[q-2]];

    for pos from -(q-2) to q-2 do
        sys :=
        [op(sys),
         A[pos] + `if`(pos=0, -1, 0) =
         z * A[pos-1] + z * A[pos+1]];
    od;

    sol := solve(sys, [seq(A[p], p=-(q-1)..q-1)]);

    eq := T = 2*z*T +
    z * subs(op(1, sol), A[-(q-1)] + A[q-1]);
    solve(eq, T);
end;

Q := (n, q) -> 
coeff(series(X(q), z=0, n+1), z, n);


ENUM :=
proc(n, q)
    option remember;
    local ind, res, lead, d, pos;

    res := 0;
    for ind from 2^n to 2^(n+1)-1 do
        d := convert(ind, base, 2);

        lead := 0;

        for pos to n do
            if d[pos] = 1 then
                lead := lead + 1;
            else
                lead := lead - 1;
            fi;

            if lead = q or lead = -q then
                break;
            fi;
        od;

        if pos < n+1 then
            res := res + 1;
        fi;
    od;

    res;
end;


This  method is  computation intensive.  We hope  to see  the numerics
verified by a future post.
   What   we  have   here   is   closely   related  to   the   DFA
method.
 There is, among others, this entry at the OEIS, OEIS A216212.