What is the probability that 2048 bit long binary number doesn't consist 5 consecutive 1's or 0's? And how can the solution be generalized for n bit long binary number and m consecutive 1's or 0's?   
I tried a recursive approach. I took a n-bit long binary number that can satisfy the condition and tried to create (n+1) bit long number by adding 0 or 1 to it. But I have to consider whether last 4-digits of n-digit number is all 0's or all 1's. I am stuck at this point.
 A: For $1\le k<m$, let $f(n,k)$ be the number of $n$ bit strings that do not have $m$ consecutive equal bits and end in $k$ equal bits.
Clearly, $f(n,k)=2^{n-k}$ for $k< n<m$ and $f(n,k)=2$ for $k=n<m$.
Beyond that, we have the recursion
$$f(n+1,1)= f(n,1)+\ldots+f(n,m-1)$$
and
$$f(n+1,k)= f(n,k-1)\qquad\text{for }1<k<m.$$
We can eliminate most by letting $g(n)=f(n,1)$ to obtain the recursion
$$ g(n+1)=g(n)+g(n-1)+\ldots+g(n-m+1).$$
The probability finally is 
$$ \frac{g(n+1)}{2^n}$$
and we can now just unwind the above recursion to compute the result for $m=5$ and $n=2048$.
Note that as a rule of thumb we'd expect about $(n-m+1)\cdot 2^{1-m}$ repeats, so about 127 in the given example. This makes us suspect that the probability of no  repeat of $m4 bits at all is very low.
A: I'm going to design a Markov Chain. 


*

*Let the Markov Chain's states be $S = \Big\{S_{1} = \{0\}, S_{2} = \{00\},S_{3} = \{000\},S_{4} = \{0000\},S_{5} = \{1\},S_{6} = \{11\},S_{7} = \{111\},S_{8} = \{1111\}\Big\}$

*According to above states, the transition matrix is as follows:
$P_{S_{i},S_{j}} = 0 , 1\leq i,j\leq 4$ 
$P_{S_{i},S_{j}} = 0 , 5\leq i,j\leq 8$ 
$P_{S_{i},S_{1}} = \frac{1}{2}, 5\leq i\leq 8$
$P_{S_{i},S_{2}} = \frac{1}{4}, 5\leq i\leq 8$ 
$P_{S_{i},S_{3}} = \frac{1}{8}, 5\leq i\leq 8$
$P_{S_{i},S_{4}} = \frac{1}{16}, 5\leq i\leq 8$
$P_{S_{i},S_{5}} = \frac{1}{2}, 1\leq i\leq 4$
$P_{S_{i},S_{6}} = \frac{1}{4}, 1\leq i\leq 4$
$P_{S_{i},S_{7}} = \frac{1}{8}, 1\leq i\leq 4$
$P_{S_{i},S_{8}} = \frac{1}{16}, 1\leq i\leq 4$

*The initial distribution is $P_{S_{i}} = \frac{1}{8}, 1\leq i\leq 8$.

*By solving this Markov Chain, you can compute any thing ....
A: A 2048 bit number has 2044 blocks of 5 consecutive bits (think 1,2,3,4,5 to 2044, 2045, 2046, 2047, 2048).
The chance of a block of 5 bits containing five consecutive 1's is 0.5^5 = 0.03125. Therefore, the chance of a block of 5 not being five 1's is 0.96875.
The chance of five 0's is also 0.03125. Therefore, not five 0's is 0.96875.
We'll create a binomial distribution of 2044 trials and p = 0.96875:

X ~ B(2044, 0.96875), where X is the event of five 0's not occuring consecutively.

Probability of 2044 out of 2044 successes (i.e there's never 5 consecutive 0's):

P(X = 2044) = [< 0.000001] - (this is only accounting for zeroes OR ones, not both!)

We'd have to square this answer to get the result for no five 0's AND no five 1's.

Stat Trek gives the result of [< 0.000001] at around 500 trials, so it's going to be a lot smaller for 2044 trials. Once this number is squared, you can see why this number is going to be tiny.
The chances of not having five 0's AND not having five 1's in a block of 5 random bits is only 94%. The odds of something with 94% chance happening every single time for 2044 attempts is going to be very small.
