Probability event with $70$% success rate occurs three consecutive times for sample size $n$ It has been a long time since I've done probability so I am not sure which to do (if either are correct). Thank you for taking the time to look at my work.
Probability an event occurs is $70$%.
I'm looking for the probability our event occurs three times in a row for sample size $n$.
$(.7)^3=.343$ is the probability to occur three consecutive times
$1-.343=.657$ would be the chance to fail.
First idea:
For $n=3$ our success rate is $.343$
$n=4$ we have two opportunities for success, thus $1-(.657)^2=.568351$
$n=5$, three opportunities for success, thus $1-(.657)^3=.71640$...
Generalization: Probability for success: $$1 - (.657)^{n-2}$$
Second idea:
Probability when $n=3$ would be $(.7)^3$
At $n=4$ we'd have $(.7)^3+(.3)(.7)^3$
For $n=5$ we'd have $(.7)^3+(.3)(.7)^3+(.3)^2(.7)^3+(.3)(.7)^4$
I'm leaning towards the second idea...but I'm failing to see a generalization for it.
Please excuse my LaTeX it has been a long time since I've asked/answered any questions. Thank you.
 A: 
Let's denote the event under consideration with $a$
  \begin{align*}
P(X=a)=0.7
\end{align*}
  and we denote the complementary event with $b$.

We are looking for the words of length $n$ and their probability of occurrence which do not contain three or more consecutive $a$'s. The result is $1$ minus this probability.

We can describe the set of these invalid words as the words built from the alphabet $V=\{a,b\}$ which contain at most one or two consecutive $a$'s.
These are words
  
  
*
  
*starting with zero or more $b$'s:$$b^*$$
  
*followed by zero or more occurrences of $a$ or $aa$ each followed by one or more $b$'s: $$(ab^+|aab^+)^*$$
  
*and terminating with zero, one or two $a$'s
  $$(\varepsilon|a|aa)$$
We obtain
\begin{align*}
b^*(ab^+|aab^+)^*(\varepsilon|a|aa)\tag{1}
\end{align*}

The regular expression (1) generates all invalid words in a unique manner. In such cases we can use it to derive a generating function $$\sum_{n=0}^\infty a_n z^n$$ with
$a_n$ giving the number of invalid words of length $n$.
In order to do so all we need to know is the geometric series expansion since the $star$ operator
\begin{align*}
a^*=\left(\varepsilon|a|a^2|a^3|\cdots\right)\qquad\text{ translates to }\qquad 1+z+z^2+z^3+\cdots=\frac{1}{1-z}
\end{align*}
Accordingly $a^+=aa^*$ translates to $\frac{z}{1-z}$ and alternatives like $(\varepsilon|a|aa)$ can be written as $1+z+z^2$.

We  translate the regular expression (1) into a generating function (by mixing up somewhat the symbolic to provide some intermediate steps).
Since we want to calculate the probabilities of occurrence of $P(X=a)$ we keep track of $a$ and $b$ by respecting them as corresponding factors in the generating function.
\begin{align*}
b^*\left(ab^+|aab^+\right)^*(\varepsilon|a|aa)
&\longrightarrow \quad \frac{1}{1-bz}\left(\left.\frac{abz^2}{1-bz}\right|\frac{a^2bz^3}{1-bz}\right)^*\left(1+az+a^2z^2\right)\\
&\longrightarrow \quad \frac{1}{1-bz}\left(\frac{abz^2+a^2bz^3}{1-bz}\right)^*(1+az+a^2z^2)\\
&\longrightarrow \quad \frac{1}{1-bz}\cdot\frac{1}{1-\frac{abz^2+a^2bz^3}{1-bz}}(1+az+a^2z^2)\\
&\quad\quad=\frac{1+az+a^2z^2}{1-bz-abz^2-a^2bz^3}\tag{1}
\end{align*}

$$ $$

We conclude: The number of invalid words is given by (1). So, the number of valid words is the number of all words minus the number of invalid words. We obtain the generating function $A(z)$
  \begin{align*}
A(z)&=\sum_{n=0}^\infty(a+b)^nz^n-\frac{1+az+a^2z^2}{1-bz-az^2-a^2z^3}\\
&=\frac{1}{1-(a+b)z}-\frac{1+az+a^2z^2}{1-bz-az^2-a^2z^3}\\
&=\frac{a^3z^3}{(1-(a+b)z)(1-bz-abz^2-a^2bz^3)}\\
&=a^3z^3+a^3(a+2b)z^4+a^3(\color{blue}{1}a^2+\color{blue}{4}ab+\color{blue}{3}b^2)z^5\\
&\qquad a^3(a+b)^2(a+4b)z^6+a^3(a^4+7a^3b+18a^2b^2+16ab^3+5b^4)z^7+\cdots
\end{align*}
The expansion was done with the help of Wolfram Alpha. We see that e.g. the number of valid words of length $5$ is $\color{blue}{1}+\color{blue}{4}+\color{blue}{3}=8$.

$$ $$

Out of $2^5=32$ binary words of length $5$ there are $8$ valid words which are marked $\color{blue}{\text{blue}}$ in the table below.
We obtain
  \begin{array}{cccc}
\color{blue}{aaa}aa\qquad&ab\color{blue}{aaa}\qquad&b\color{blue}{aaa}a\qquad&bb\color{blue}{aaa}\\
\color{blue}{aaa}ab\qquad&abaab\qquad&b\color{blue}{aaa}b\qquad&bbaab\\
\color{blue}{aaa}ba\qquad&ababa\qquad&baaba\qquad&bbaba\\
\color{blue}{aaa}bb\qquad&ababb\qquad&baabb\qquad&bbabb\\
aabaa\qquad&abbaa\qquad&babaa\qquad&bbbaa\\
aabab\qquad&abbab\qquad&babab\qquad&bbbab\\
aabba\qquad&abbba\qquad&babba\qquad&bbbba\\
aabbb\qquad&abbbb\qquad&babbb\qquad&bbbbb\\
\end{array}

We denote with $[z^n]$ the coefficient of $z^n$ in a series.

We conclude
  
  
*
  
*The number of occurrences of wanted words of size $n$ is the coefficient of $z^n$ of $A(z)$ evaluated at $a=b=1$ and given as OEIS sequence 050231.
  
  
  \begin{align*}
\left.[z^n]A(z)\right|_{a=b=1}
\end{align*}
  
  
*
  
*The wanted probability of valid words of size $n$ is the coefficient of $z^n$ of $A(z)$ evaluated at $a=0.7,b=0.3$.
  \begin{align*}
\left.[z^n]A(z)\right|_{a=0.7,b=0.3}
\end{align*}
  
*We obtain for $n=0$ up to $n=7$
  \begin{array}{c|cl}
n&\left.[z^n]A(z)\right|_{a=b=1}&\left.[z^n]A(z)\right|_{a=0.7,b=0.3}\\
\hline
0&0&0\\
1&0&0\\
2&0&0\\
3&1&0.343\\
4&3&0.4459\\
5&8&0.5488\\
6&20&0.6517\\
7&47&0.7193\\
\end{array}

A: The issue with looking at opportunities for success is that they are not completely independent. For example, in a row of size 4, if the first three aren't all successes, this greatly decreases the chance that the last three aren't all successes (the only way this can happen is if only the first trial was a failure).
You can still get this approach to work (via correcting for events which are dependent via some sort of inclusion-exclusion), but generally a cleaner method for these types of problems is to write down a recurrence (or more generally, model them as a finite state Markov chain).
Let's let $P(N)$ be the probability a row of length $N$ has no 3 consecutive successes. To help us write down a recurrence, we'll break $P(N)$ down into 3 smaller probabilities. Let's let $P(N, 0)$ be the probability a row of length $N$ has no 3 consecutive successes AND that the last attempt was a failure. Similarly, let $P(N,1)$ be the probability that a row of length $N$ has no 3 consecutive successes AND that the last attempt was a success, but the second-last attempt was a failure, and finally, let $P(N,2)$ be the probability that a row of length $N$ has no 3 consecutive successes AND the last two attempts were successes, but the third-to-last attempt was a failure. Intuitively, these different cases measure how "close" we are to getting 3 successes in  a row. It's not too hard to see that $P(N) = P(N,0) + P(N,1) + P(N,2)$, since if the last three attempts are all successes, you've already won.
Now, let's try to write $P(N+1, 0)$ in terms of smaller cases. The probability you have no 3 consecutive successes in a row of length $N+1$ and that your last attempt was a failure is simply the probability that there are no 3 consecutive successes in the first $N$ tries and that you fail the $N+1$st try. This gives us the equation:
$$P(N+1,0) = 0.3P(N) = 0.3P(N,0) + 0.3P(N,1) + 0.3P(N,2)$$
Via similar logic, we can show that $P(N+1,1)$ and $P(N+1,2)$ satisfy the following equations:
$$P(N+1,1) = 0.7P(N, 0)$$
and
$$P(N+1,2) = 0.7P(N, 1)$$
Substituting these into the original equation for $P(N+1,0)$, we get:
$$P(N+1, 0) = 0.3P(N,0) + 0.21P(N-1, 0) + 0.147P(N-2,0)$$
Now, this is just a standard linear recurrence relation. If $\lambda_1$, $\lambda_2$, and $\lambda_3$ are the roots of $z^3 - 0.3z^2-0.21z-0.147=0$, then there are some constants $a_1, a_2, a_3$ which you can solve for so that
$$P(N, 0) = a_1\lambda_1^N + a_2\lambda_2^N + a_3\lambda_3^N$$
Since $P(N) = P(N+1,0)/0.3$, this gives a similar formula for $P(N)$ (and ultimately for $1-P(N)$, the probability a success does occur 3 consecutive times). 
A: Let $p=0.7$ be the probability of success, $\mathrm{f}(n)$ be the probability of a sequence of length $n$ having 3 consecutive successes and $\mathrm{g}(n)=1-\mathrm{f}(n)$, where $\mathrm{g}(n)$ corresponds to the probability of a sequence of length $n$ having at most 2 consecutive successes.
It holds $\mathrm{g}(0) = \mathrm{g}(1) = \mathrm{g}(2) = 1$.
Then $\mathrm{g}(n) = (1-p)\mathrm{g}(n-1) + (1-p)p\mathrm{g}(n-2) + (1-p)p^2\mathrm{g}(n-3)$.
This holds because all sequences of length $n$ that have at most 2 consecutive successes can be constructed from (1) all such sequences of length $n-1$ suffixed by a failure plus; (2) all such sequences of length $n-2$ suffixed by a failure and a success, plus; (3) all such sequences of length $n-3$ suffixed by a failure and two successes.
A: I saw that the answers to the question include either regex (Automata Theory) or linear recurrences (Linear Algebra), so for those interested I decided to post this paper on generating functions that neatly explains the interconnection between them.
