counting bitstrings of specific length

187 Views Asked by At

Is my solution right refarding this question?

How many bitstrings of length 77 are there that start with 010 (i.e, have 010 at position 1, 2, and 3) or have 101 at positions 2,3, and 4, or have 010 at positions 3, 4, and 5?

the answeer i got is |AuBuC| = |A| + |B| + |C| -|A and B| - |A and C| - | B and C| + |A and B and C|

= 2^74 + 2^74 + 2^74 - 2^71 - 2^71 - 2^71 + 2^68

1

There are 1 best solutions below

4
On

Ignoring the bits 6 to 77, you have

00000
00001
00010 C
00011
00100
00101
00110
00111
01000 A
01001 A
01010 A B C
01011 A B
01100
01101
01110
01111
10000
10001
10010 C
10011
10100
10101
10110
10111
11000
11001
11010 B C
11011 B
11100
11101
11110
11111

So in total 8.2^72 = 2^75 solutions.

By inclusion/exclusion, (4 + 4 + 4 - 2 - 1 - 2 + 1).2^72 = 2^75.