Here is my attempt: So denote by $P_i$ the probability of having $10$ heads in a row in $i$ tosses. So $P_{10}=1/2^{10}$.
For $i=10,...,20$, we can calculate the probability straight forward by saying: Probability that I get $10$ heads row and my heads start at $1$ plus probability that I get $10$ heads in a row and I start at $2$ plus, and so on. For instance, for $i=16$ we have $1/2^{10}+6/2^{11}=0.390625$ precisely what you got.
When $i>20$, then the counting becomes a little more messy, but I think its doable using recursion. Note that $P_{i+1}=P_i+$Probability that my $10$ heads in a row start at $i-9$ (let me denote this probability $Q_i$). So you know that $P_i$ is for the first couple of cases, note that $Q_i$ for $i\leq 20$ is just $1/2^{11}$ because we need a $T$ to go on the $i-10$ position and followed by $10$ heads, however, that does not work for say $i=21$ because we want more, we want the $11$th position to be a $T$, the following to be 10 $H$s, and the previouse ones not to be a string of $10$ heads because we are counting the strings whose starting point is at $12$. Thus, $Q_{21}=(1/2^{11})(1-P_{10})$. Hence, $P_{21}=P_{20}+Q_{21}$ to exactly what you have.
For $P_{22}=P_{21}+Q_{22}$ where $Q_{22}=(1/2^{11})(1-P_{11})$, I just checked and indeed I get the same result.
In general, you can build them recursively, and use $Q_i=(1/2^{11})(1-P_{i-11})$.
A little more clear (above was me thinking as I typed, so it turned out somewhat messy): You can denote $P_0,..,P_9$ all to be $0$, $P_{10}=1/2^{10}$, and $P_n=P_{n-1}+(1/2^{11})(1-P_{n-11})$.
Let $a_n$ be the number of sequences of length $n$ that do not contain two consecutive heads.
Observe that any sequence of heads and tails of length one is permissible since we cannot obtain two heads in a row. Hence, $a_1 = 2$.
Any sequence of length two is permissible except HH. Hence, $a_2 = 2^2 - 1 = 3$.
We can write a recurrence relation for a sequence of length $n$. An admissible sequence of length $n$ that ends in heads must have a tails in the $(n - 1)$st position. Hence, any sequence of length $n$ that ends in heads corresponds to an admissible sequence of length $n - 2$ to which the sequence TH is appended. There are $a_{n - 2}$ such sequences. An admissible sequence of length $n$ that ends in tails is an admissible sequence of length $n - 1$ to which a tails is appended. There are $a_{n - 1}$ such sequences. Hence, we have the recurrence relation
$$a_n = a_{n - 1} + a_{n - 2}$$
Thus, the number of admissible sequences of length $n$ is given by the recursion
\begin{align*}
a_1 & = 2\\
a_2 & = 3\\
a_n & = a_{n - 1} + a_{n - 2}, n \geq 3
\end{align*}
Notice that $a_3 = 5$, $a_4 = 8$, and $a_5 = 13$. You may recognize these as Fibonaccci numbers. In particular, $a_n = F_{n + 2}$.
The desired probability is
$$\frac{a_n}{2^n}$$
Best Answer
Let's count the number of ways not to get $7$ heads in a row. We will put together atoms that consist of $0$ to $6$ heads followed by a tail. Any arrangement of heads and tails without $7$ heads in a row, appended with a tail, can be uniquely made up of a number of such atoms.
All arrangements of such atoms appear once somewhere in the sum $$ \sum_{k=0}^\infty(x+x^2+x^3+x^4+x^5+x^6+x^7)^k $$ where
$x$ represents $T$
$x^2$ represents $HT$
$x^3$ represents $HHT$
$\vdots$
$x^7$ represents $HHHHHHT$
For example, if we are looking for $HTTHHTTH$, append a $T$ and we get the term for $k=5$ where in the first factor, the $x^2$ ($HT$) was chosen, in the second factor, the $x$ ($T$) was chosen, then $x^3$ ($HHT$), then $x$ ($T$), then $x^2$ (HT), to get $HTTHHTTHT$. Note that the exponent of $x$ matches the number of tosses. To count the number of sequences of $40$ flips that do not contain $7$ consecutive heads, we look at the coefficient of $x^{41}$ in $$ \begin{align} \sum_{k=0}^\infty(x+x^2+x^3+x^4+x^5+x^6+x^7)^k &=\frac1{1-x\frac{x^7-1}{x-1}}\\ &=\frac{1-x}{1-2x+x^8} \end{align} $$ The coefficient of $x^{41}$ is $955427104501$. There is a degree $8$ recursion to compute this without dividing polynomials: $c_n=2c_{n-1}-c_{n-8}$, where $c_n$ starts $$ 1,1,2,4,8,16,32,64,\dots $$
The number of sequences of $40$ flips is $2^{40}$. Therefore, the probability of getting a sequence of $7$ heads in a row in $40$ flips is $$ 1-\frac{955427104501}{2^{40}}=0.131044110526 $$