Given 10 digits, how many ways can they be arranged so that two odds cannot be adjacent?

13.1k Views Asked by At

Given $10$ digits, where each digit can be an integer from $0$ to $9$, how can I determine the number of ways to arrange the numbers so that two odds are not adjacent?

Repetition of digits is not allowed.

So far, I have figured out the total number of possibilities: $$10 \cdot 9 \cdot 8 \cdot 7 \cdot 6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1 = 10!$$

Then I had planned to subtract the number of bad possibilities from the total number of possibilities.$$10! - X$$ Where $X$ is all the bad possibilities, which means $X$ is all the possibilities where two odds could be next to each other in the $10$ digits.

I know that for each number, $5$ odds can be selected, how can I use this information to figure out the answer to the question?

3

There are 3 best solutions below

3
On BEST ANSWER

There are six different admissible assignments of odd (O) and even (e) numbers:

OeOeOeOeOe
OeOeOeOeeO
OeOeOeeOeO
OeOeeOeOeO
OeeOeOeOeO
eOeOeOeOeO

For these arrangements of parity there are $5!$ ways of fixing the odd numbers, and the same number of ways to fix the even numbers. Thus there are $6×5!×5!=86400$ ways.

6
On

Let $O$ and $E$ be the odd and even numbers respectively.

The odd digits are $1,3,5,7,9$.

The even digits are $0,2,4,6,8$.

$_E_E_E_E_E_$

If you are filling the odd numbers in any $5$ blank spaces yiels a required number.

There are $6$ blank spaces. So the number of ways to select $5$ spaces among $6$ spaces $=6C5 =6$.

Number of possible shuffling on $5$ odd number is $=5!=120$.

Again,Number of possible shuffling on $5$ even number is $=5!=120$.

Thus total number of possibility is $=6×120×120=86400$.

0
On

This is almost same as the previous answers, but I’m going to present it in an (arguably) less brute-force manner.

We first observe that if we partition the digits in any valid permutation into 5 pairs, each pair must have exactly 1 odd and 1 even digits, for otherwise, there must be at least one (odd, odd) pair. (An unordered pair can only be (odd, even), (even, even) and (odd, odd). If (even, even) appears, since the numbers of odd and even digits are the same (both 5), there must be an (odd, odd) pair to balance it.)

Now fix the odd digits $1, 3, 5, 7, 9$ and assign each digit an even digit. So there are $5!$ ways to assign the even digits.

Now we have $5$ (odd, even) pairs. To permutate them we have another $5!$ ways.

Next, we are going to merge the pairs. Since no two odd digits can be adjacent, we observe the following: if the previous pair is (even, odd), then the next pair must be (even, odd). Otherwise, we can choose to have (even, odd) or (odd, even).

Hence we can “switch” to (even, odd) at any of 5 pairs, and we can switch at most once. The remaining possibility is not to switch at all. Hence for every pair set containing 5 pairs, there are altogether $6$ switching possibilities.

It follows that the number of permutations is $5!\times5!\times6 = 86400$.