Number-code combinatorics problem

455 Views Asked by At

I'm working through a high-school data management textbook, and this is the only problem so far that I can't solve - it seems way harder than any other:

"Caleb needs to create an $8$-digit password using only numbers. How many different passwords are there if he wants to use $00$ exactly once?"

So far my reasoning has been "There are seven positions for the $00$ to go, and each leaves $6$ digits to be chosen, there are $9$ choices for each digit next to one of the zeros, then ten choices for each of the non-zero digits next to the zeros..." after that I get stuck, as I don't know how to take into account the fact that, when you choose a digit next to one of the digits next to the zeros, you will have $10$ choices $9$ out of $10$ times, and $9$ choices one out of $10$ times, or how to relate this to the different positions the double-zero could be in. Any help would be greatly appreciated.

1

There are 1 best solutions below

1
On

We consider cases, depending on the number of zeros in the eight-digit password.

Exactly two zeros: We begin by arranging the $8 - 2 = 6$ nonzero digits. There are nine choices for each nonzero digit. Arranging them creates seven spaces in which we can place the $00$.
$$\square d \square d \square d \square d \square d \square d \square$$ Choose one of the seven spaces for the $00$. The number of possible arrangements with exactly two zeros is $$\binom{7}{1}9^6$$

Exactly three zeros: We begin by arranging the $8 - 3 = 5$ nonzero digits. Again, there are nine choices for each nonzero digit. This creates six spaces in which we can place the zeros.
$$\square d \square d \square d \square d \square d \square$$ If we have three zeros and exactly two of them are adjacent, we must place a $00$ in one of these six spaces and a $0$ in one of the remaining five spaces.

There are $$\binom{6}{1}\binom{5}{1}9^5$$ such arrangements.

Exactly four zeros: We begin by arranging the $8 - 4 = 4$ nonzero digits. As above, there are nine choices for each nonzero digit. This creates five spaces in which we can place the zeros. $$\square d \square d \square d \square d \square$$ If we have four zeros and exactly two of them are adjacent, we must choose one of these five spaces for the $00$ and two of the remaining four spaces for the two single zeros.

There are $$\binom{5}{1}\binom{4}{2}9^4$$ such arrangements.

Exactly five zeros: We begin by arranging the $8 - 5 = 3$ nonzero digits. There are nine choices for each of the three nonzero digits. This creates four spaces in which we can place the zeros. $$\square d \square d \square d \square$$ If we have five zeros, exactly two of which are adjacent, we must choose one of these four spaces for the $00$ and fill each of the remaining three spaces with a single $0$.

There are $$\binom{4}{1}\binom{3}{3}9^3$$ such arrangements.

Convince yourself that it is not possible to have only one pair of consecutive zeros if there are at least six zeros in the eight-digit password. Since the above cases are mutually exclusive and exhaustive, the answer can be obtained by adding the above cases.