How to find the number of times at least two ones are adjacent out of all possible permutations of $\{0, 0, 0, 0, 1, 1, 1, 1\}$ My question is this. 

How do I find the amount of times at least two ones are adjacent when the sample of characters is $$\{0, 0, 0, 0, 1, 1, 1, 1\}$$

My instinct is to sum the amount of possibilities when two, three our four will be in a row: 
$$\frac{8!}{(8-4)!}+\frac{8!}{(8-5)!}+\frac{8!}{(8-6)!}$$
Which gives me the answer of $28,560$ out of $40,320$ permutations.
However, when I brute force the question in Python, I find that there are $37,440$ possibilities of adjacency.
I'm not really sure what I'm doing wrong here.
 A: Two permutations of the bit string $00001111$ are distinguished by the positions in which the ones and zeros appear.  A particular bit string is completely determined by choosing which four of the eight positions are filled with ones.  The remaining positions must be filled with zeros.  For instance, if we place the ones in positions 1, 2, 6, and 8, the bit string is $11000101$.  Therefore, the number of distinguishable bit strings that can be formed by permuting four ones and four zeros is 
$$\binom{8}{4}$$
We want to count the number of bit strings formed from four ones and four zeros that have at least two adjacent ones.  To do so, we subtract the number of bit strings with no two adjacent ones from the total.  Line up the four zeros.  This creates five spaces in which to place a one, three between successive zeros and two at the ends of the row.
$$\square 0 \square 0 \square 0 \square 0 \square$$
To ensure that no two ones are adjacent, we must choose four of these five spaces in which to place a $1$, which can be done in 
$$\binom{5}{4}$$
ways.
Therefore, there are 
$$\binom{8}{4} - \binom{5}{4} = 70 - 5 = 65$$
distinguishable bit strings composed of four zeros and four ones in which at least two ones are adjacent.
About your calculation
In order to get $8! = 40,320$ distinguishable bit strings, you would have to distinguish between individual ones and individual zeros, say by painting each one a different color and each zero a different color.
$$\color{red}{1}\color{blue}{1}\color{brown}{0}\color{orange}{0}\color{magenta}{0}\color{cyan}{1}\color{purple}{0}\color{green}{1}$$
Then we would have 
$$\binom{8}{4}4!4! = 40,320$$
distinguishable bit strings.
To count bit strings in which no two ones were adjacent, we could line up the four zeros in $4!$ ways, creating five spaces as above.  We could choose four of these five spaces in which to insert a one in $\binom{5}{4}$ ways, and arrange the four ones in the selected spaces in $4!$ ways, giving 
$$\binom{5}{4}4!4!$$
bit strings in which no two ones were adjacent.
Thus, if the zeros and ones were distinguishable, the number of bit strings composed of four ones and four zeros in which at least two ones were distinguishable would be 
$$\binom{8}{4}4!4! - \binom{5}{4}4!4! = \left[\binom{8}{4} - \binom{5}{4}\right]4!4! = 65 \cdot 576 = 37,440$$
That said, since the four ones are indistinguishable and the four zeros are indistinguishable, there are just $65$ distinguishable bit strings composed of four ones and four zeros in which at least two ones are adjacent.
About your instinct
A bit string composed of four ones and four zeros has at least two adjacent ones in one of the following four cases:


*

*There are exactly two adjacent ones.

*There are two disjoint pairs of adjacent ones.

*There are exactly three adjacent ones.

*There are four adjacent ones.


There are exactly two adjacent ones:  Line up the four zeros, creating the five spaces indicated above.  To ensure that exactly two ones are ajdacent, choose one of these five spaces in which to place a pair of adjacent ones and two of the remaining four spaces in which to place the remaining two ones.  There are 
$$\binom{5}{1}\binom{4}{2}$$
such bit strings.
There are two disjoint pairs of adjacent ones:  Line up the four zeros, creating the five spaces indicated above.  To separate the pairs of adjacent ones, choose two of these five spaces in which to place pairs of adjacent ones. This can be done in
$$\binom{5}{2}$$
ways.
There are exactly three adjacent ones:  Line up the four zeros, creating the five spaces indicated above.  To ensure that exactly three ones are adjacent, choose one of the five spaces for the block of three adjacent ones and one of the remaining four spaces for the remaining one.  This can be done in 
$$\binom{5}{1}\binom{4}{1}$$
ways.
All four ones are adjacent: Line up the four zeros, creating the five spaces indicated above.  Choose one of these five spaces in which to place the block of four adjacent ones.  This can be done in 
$$\binom{5}{1}$$
ways. 
Total:  The number of bit strings composed of four ones and four zeros in which at least two ones are adjacent is 
$$\binom{5}{1}\binom{4}{2} + \binom{5}{2} + \binom{5}{1}\binom{4}{1} + \binom{5}{1} = 5 \cdot 6 + 10 + 5 \cdot 4 + 5 = 30 + 10 + 20 + 5 = 65$$
as we found above.
A: The only time when no two $1$'s will be adjacent is if the permutation produces any of the following five strings:
01010101
10010101
10100101
10101001
10101010

For each of these strings, the zeros and ones can be permuted in $4!4!=576$ ways. This leaves $40320-5×576=37440$ admissible permutations.
