# How many bit strings of length eight either start with a 1 bit or end with the two bits 00?

**bit strings of length**8 that

**start**with

**1**and

**end**with

**00**: 25 = 32. Applying the subtraction rule, the number is 128 + 64 − 32 = 160.

Also to know is, how many bit strings of length ten either start with a 1 bit or end with the two bits 00?

**Bits** are **either 1** or 0, so there are 2 choices per **bit**, and 8 **bits** to choose. Therefore, there are 28 = 256 **bit strings of length ten** that **begin** and **end** with a **1**.

**256 eight**-bit ascii codes, for instance.

Considering this, how many bit strings of length 8 begin and end with a 1?

My answer would be: 26. Because we know, that the **bit starts** with **1** and **ends** with **1**: Which means, that 2 of the **length 8** is used, also there are 6 positions remaining, which is 26=64.

There are only two 8-bit strings in which the bits alternate: **10101010** and 01010101. The total number of 8-bit strings with no restrictions is 2^8. Therefore the number of 8-bit strings which have at least two consecutive 0's or at least two consecutive 1's is 2^8 - 2.