Skip to main content.

Answer to puzzle 145: Heads and tails

The probability that when a fair coin is tossed n times a head immediately follows a head exactly h times and a tail immediately follows a tail exactly t times is:

C((n + h - t)/2 - 1, h) * C((n - h + t)/2 - 1, t)/2^(n-1) , if n − h − t is even.
1/2^n , if h = n − 1 or t = n − 1.
(C((n + h - t - 1)/2, h) * C((n - h + t - 3)/2, t) + C((n + h - t - 3)/2, h) * C((n - h + t - 1)/2, t))/2^n , otherwise.