asked 95.6k views
5 votes
how many binary strings of length 5 have at least 2 adjacent bits that are the same ("00 or "11) somewhere in the string?

asked
User Merlyn
by
8.2k points

1 Answer

7 votes

We can find a formula to calculate it for any given n-bits binary.

Let's analyze it. It is actually simple. First to calculate the number of all possible different number we use

2^n = number of possible different binary numbers of n bits length.

Now, we know that all this possible numbers will have 11 or 00 on them except for two. These are the ones with the bits 0s and 1s are either 01010101… or 10101010…

That is when the bit in position x not equal the bit in position x+1.

So the final formula will be:

(2^n) - 2 = number of possible binary numbers with 11 or 00.

So the answer is (2^5) - 2 = 32 - 2 = 30.

answered
User Mark Ch
by
8.1k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.