# Combinations Positioning of Digits

2A) Find the number of ways to write four 0's and five 1's in a row so that no two zeroes are next to each other.

So I understand the basic structure of this problem is "0101010" but how do you factor in the remaining two 1's to calculate the number of ways to write the sequence?

2B) Find the number of ways to write digits 1 through 9 in a row (so each digit appears exactly once) and no two digits EVEN digits are next to each other.

I feel like this is the same logic as A but I have no idea how to solve.

## 2 Answers

Find the number of ways to write four $0$s and five $1$s in a row so that no two zeros are next to each other.

If we write down a row of five ones, we create six spaces in which we could place a zero, four between successive ones and two at the ends of the row.

$$\square 1 \square 1 \square 1 \square 1 \square 1 \square$$

To separate the zeros, we choose four of these six spaces in which to insert a single zero. For instance, if we choose the first, third, fourth, and fifth places, we obtain $$011010101$$ The number of such choices is $$\binom{6}{4} = 15$$ Hence, there are $15$ sequences of four zeros and five ones in a row in which no two zeros are adjacent.

Find the number of ways to write the digits $1$ through $9$ in a row so each digit appears exactly once and no two even digits are next to each other.

1. Arrange the odd digits in a row. In how many ways can this be done?
2. How many spaces does this create?
3. To separate the even digits, how many of these spaces must we choose?
4. Arrange the even digits in the chosen spaces. In how many ways can this be done?

A) As you say, you have to add two 1s to 0101010. Now there are five different places you can add a 1: at the start, in between the first and second 0, etc. Notice that if you decide to add a 1 between the first and second 0, it doesn't matter whether you put it before or after the 1 that's already there, as either way you get the same thing. You have two 1s, so you can either put both in the same place (in $5$ ways) or choose two different places (in $\binom 52=10$ ways) to put them in.

B) This is the same sort of thing as A, thinking of even digits as 0 and odd digits as 1. So for each pattern of 0s and 1s, how many ways are there to replace the $4$ 0s with the $4$ even digits in some order, and how many ways are there to replace the $5$ 1s with the $5$ odd digits?