# Number of license plates with not more than one pair of consecutive identical digits

I solved the following problem, but not sure if I did it right:

"One country has $5$-digit license plates for cars but with condition that there are not more than one pair of consecutive identical digits. So, license plate $22343$ is fine, but $78855$, $12333$, $11111$ are not. How many license plates can be in this country? License plates can start with $0$'s"

My approach was to sum number of plates with all different digits and number of plates with one pair of consecutive identical digits.

So number of plates with all different digits is

$10\cdot 9\cdot 8\cdot 7\cdot 6 = 30240$

When we have one pair of consecutive identical digits, it can be placed on one of four positions:

XX _ _ _

_ XX _ _

_ _ XX _

_ _ _ XX

And for each option we have $10\cdot 9\cdot 9\cdot9 = 7290$ license plates.

So the final answer is $30240 + 7290\cdot 4 = 59400$

I'm not sure if it's correct and want to check.

## 1 Answer

We wish to count the number of five-digit strings that contain at most one pair of consecutive identical digits. There are two cases:

1. The string contains no pairs of consecutive identical digits. This case includes license plates with five different digits such as $23075$ and license plates such as $43563$ in which a digit may be repeated but does not appear in consecutive positions.
2. The string contains exactly one pair of consecutive identical digits. This case includes license plates such as $45561$ but not $22344$.

Case 1: We have ten ways of choosing the first digit. Each subsequent digit must be one of the nine digits that is different from the preceding digit.
$$10 \cdot 9 \cdot 9 \cdot 9 \cdot 9 = 65610$$

Case 2: You handled this case correctly.

Total: $65610 + 29160 = 94770$