Suppose that a head never appears more than twice in a row. That means that the sequence of 20 tosses consists in

a succession of T,HT, and HHT. So the question is to count the number of combinations of objects of size 1,2 and 3 that make up 20

and divide the result N by 2^20. Finally we'll have P = 1 - N/2^20.

Let x_n the number of possible decompositions that make up to n.

1, 2 = 1 + 1, 3 = 1 + 1 + 1 = 2 + 1 + 1 + 2

So x_1 = 1, x_2 = 2, x_3 = 4.

Beyond this we have the induction relation x_(n+1) = x_n + x_(n-1) + x_(n-2).

So x_n = a*t^n + b*u^n + cv^n, where t, u and v are the roots of

x^3 = 1 + x + x^2

and a,b,c are constants. Only the real root t matters.

Let t = 1.8392867552

Then x_n - a*t^n ---> 0.

We start with 1 2 4 7 13 24 44 and then multiply by t and round up.

We get x_10 = 274, x_15 = 5768 and x_20 = 121415.

Finally your probability is 1 - 121415 / 2^20 = 0.88420963287353515625 (exactly).

Edit: x_20 takes into account only those sequences ending with T; For those ending with TH and THH we must add x_19 and x_18. Total x_18 + x_19 +x_20 = x_21.

So just replace 121415 by the next term 223317 and you get

1 - 223317/2^20 = 0.78702831268310546875.

Same as Math TG: 223317 + 825259 = 2^20