Probability of flipping coins How many times do you have to flip a coin to get a probability of 60% or higher to get 3 heads straight in a row? 
I know how to get the probability by simply counting the number of favourable outcomes/total number of outcomes. However, I am confused to do this working backwards.
 A: I am afraid it is not straightforward to solve this problem combinatorially.
Say you have $n$ tosses of a fair coin. 
Consider the running length of heads from the tail of the sequence, $\ell(n)$. I.e. is the sequence ends in THT, the running length is zero, if THH - the running length is 2, etc.
Let $p_0(n)$ denote the probability that the $\ell(n) = 0$, and we have not yet observed any sequence of 3 or more heads. Let $p_1(n)$ be the probability that $\ell(n)=1$, and that we have not yet observed the target subsequence, similarly define $p_2(n)$. 
Let $p_3(n)$ denote probability that we have observed the sequence of 3 heads in a row. 
Clearly $p_0(0) = 1$ and $p_1(0)=p_2(0)=p_3(0) = 0$.
Considering growing the sequence by a single coin toss, if the coin turns tails from any state where have not yet observed 3 or more heads, the running length plummets to zero:
$$
     p_{n+1}(0) = \frac{1}{2} p_n(0) + \frac{1}{2} p_n(1) + \frac{1}{2} p_n(2)
$$
Otherwise, if the coin turns head, the running length increments by 1:
$$
     p_{n+1}(1) = \frac{1}{2} p_n(0)
$$
$$
p_{n+1}(2) = \frac{1}{2} p_n(1)
$$
We reach the event of interest by either getting a head after previously seeing two heads, thus reaching the target event for the firth time, or if have already seen it earlier in the sequence.
$$
   p_{n+1}(3) = p_n(3) + \frac{1}{2} p_{n}(2)
$$
The problem is to find the smallest $n$, such that $p_3(n) > \tfrac{3}{5}$.
To solve this system of linear difference equations, the folk lore is to use sequence generating functions, for $k=0,1,2,3$:
$$
     g_k(z) = \sum_{n=0}^\infty z^n p_n(k)
$$
Multiplying equations by $z^{n+1}$ and summing from 0 to $\infty$:
$$
    g_{0}(z) - p_0(0) = \frac{z}{2} \left(g_0(z) + g_1(z) + g_2(z)\right)
$$
$$
    g_{1}(z) - p_1(0) = \frac{z}{2} g_0(z)
$$
$$
    g_{2}(z) - p_2(0) = \frac{z}{2} g_1(z)
$$
$$
    g_{3}(z) - p_3(0) = z g_3(z) + \frac{z}{2} g_2(z)
$$
Taking into account initial probabilities $p_0(0)=1$ and $p_1(0)=p_2(0)=p_3(0)=0$ and solving this linear system for $g_3(z)$:
$$
g_3(z) =\frac{1}{8} \cdot \frac{z^3}{(1-z) \left(1 - \tfrac{1}{2} z - \frac{1}{4} z^2 -\tfrac{1}{8} z^3\right)}
$$
Expanding the generating function around zero:
$$
  g_3(z) = \frac{z^3}{8}+\frac{3 z^4}{16}+\frac{z^5}{4}+\frac{5 z^6}{16}+\frac{47 z^7}{128}+\frac{107 z^8}{256}+\frac{119 z^9}{256}+\frac{65 z^{10}}{128}+\frac{1121 z^{11}}{2048}+\frac{2391 z^{12}}{4096}+\frac{79
   z^{13}}{128}+O\left(z^{14}\right)
$$
The first coefficient exceeding $60%$ corresponds to order 13, with approximate value being 61.72%
