Number of ways to play $n$ games without losing three in a row So I'm trying to solve this problem but I'm having a few difficulties.

A gambler decides to play successive games of blackjack until he loses three times in a row. (Thus the gambler could play five games by losing the first, winning the second, and losing the final three or by winning the first two and losing the final three.)
These possibilities can be symbolized as LWLLL and WWLLL. Let $g_n$ be the number of ways the gambler can play $n$ games. Explain your answer as well.
a. Find $g_3$, $g_4$, and $g_5$.
b. Find $g_{10}$.

When it's asking for $g_3$ for example, Am I supposed to come up with $3$ scenarios in which the win/lose events could happen?
 A: Presumably $g_n$ is the number of sequences of L and W ending in LLL in which the first time that three L's appear consecutively are at the end. So $g_3 = 1$ since the only such sequence is LLL, $g_4 = 1$ since the only such sequence is WLLL, and $g_5 = 2$ as you mention.
More generally, let $a_n,b_n,c_n$ be the number of sequences in which there are no three consecutive LLL's which end (respectively) in 0,1,2 consecutive L's. We have $g_n = a_{n-3}$ and
$$
\begin{align*}
a_0 &= 1 \\
b_0 &= 0 \\
c_0 &= 0 \\
a_{n+1} &= a_n+b_n+c_n \\
b_{n+1} &= a_n \\
c_{n+1} &= b_n
\end{align*}
$$
We can reduce it to a more usual recurrence relation using $b_n = a_{n-1}$ and $c_n = b_{n-1} = a_{n-2}$. This shows that
$$
a_{n+1} = a_n + a_{n-1} + a_{n-2}, \quad a_0 = 1, \quad a_1 = 1, \quad a_2 = 2. 
$$
In terms of $g_n$, we get
$$
g_{n+1} = g_n + g_{n-1} + g_{n-2}, \quad g_3 = 1, \quad g_4 = 1, \quad g_5 = 2. 
$$
The first few values are
$$ 1,1,2,4,7,13,24,44,81,\ldots. $$
In particular, $g_{10} = 44$.
The asymptotic growth rate of $g_n$ is $g_n = \Theta(\gamma^n)$, where $\gamma \approx1.84$ is the unique real root of the cubic $t^3-t^2-t-1$.
If instead of having a length-three losing streak you consider a length-two losing streak, you get the Fibonacci numbers (with an appropriate shift), try it!
A: Using a recurrence relation seems like the natural choice here:


*

*Let $a_n$ denote the number of combinations of length $n$ that start with $0$ Ls

*Let $b_n$ denote the number of combinations of length $n$ that start with $1$ L

*Let $c_n$ denote the number of combinations of length $n$ that start with $2$ Ls


Then:


*

*$a_6=2$ (WLWLLL, WWWLLL)

*$b_6=1$ (LWWLLL)

*$c_6=1$ (LLWLLL)

*$a_{n+1}=a_n+b_n+c_n$ (add W at the beginning of every combination)

*$b_{n+1}=a_n        $ (add L at the beginning of every combination)

*$c_{n+1}=b_n        $ (add L at the beginning of every combination)
Finally, let $g_n$ denote the number of combinations of length $n$, hence $g_n=a_n+b_n+c_n$.

For $n<6$, you need to calculate $g_n$ "manually":


*

*$g_3=1$ (LLL)

*$g_4=1$ (WLLL)

*$g_5=2$ (LWLLL, WWLLL)
Let's calculate $g_{10}$:
  n  |  a  |  b  |  c  |  g
-----|-----|-----|-----|-----
  6  |  2  |  1  |  1  |  4
-----|-----|-----|-----|-----
  7  |  4  |  2  |  1  |  7
-----|-----|-----|-----|-----
  8  |  7  |  4  |  2  | 13
-----|-----|-----|-----|-----
  9  | 13  |  7  |  4  | 24
-----|-----|-----|-----|-----
 10  | 24  | 13  |  7  | 44

