# How many four digit integers are there that do not have two consecutive equal even digits?

How many four digit integers are there that do not have two consecutive equal even digits?

My Attempt There are $9*10^3$ four digit numbers. We tie two equal even digits and form the four digit numbers with them. This can be done in $5 \cdot \binom{3}{2} \cdot 10 \cdot 10 = 1500$ ways. There are $10 \cdot 10$ numbers starting with $00$ so we must subtract them from $1500$. So answer is $9000 - 1400 = 7600$. But it is not matching with the given answer $7801$. Can any one help me to find out where I am making mistakes? Thanks in advance.

## 2 Answers

You made two errors:

1. You did not account for the fact that there are only $9$ choices for the leading digit when neither number in the pair of consecutive equal even digits is in the thousands place.
2. You have subtracted numbers in which there are three or more consecutive even digits more than once.

First, we observe that there are $9 \cdot 10 \cdot 10 \cdot 10 = 9000$ four-digit positive integers.

Let $A_1$ be the set of four-digit positive integers in which the thousands place and hundreds place contain equal even digits. Let $A_2$ be the set of four-digit positive integers in which the hundreds place and tens place contain equal even digits. Let $A_3$ be the set of four-digit positive integers in which the tens place and units place contain equal even digits. Then $A_1 \cup A_2 \cup A_3$ is the set of four-digit positive integers that do contain consecutive equal even digits. By the Inclusion-Exclusion Principle, the number of four-digit positive integers that do contain consecutive even digits is $$|A_1 \cup A_2 \cup A_3| = |A_1| + |A_2| + |A_3| - |A_1 \cap A_2| - |A \cap A_3| - |A_2 \cap A_3| + |A_1 \cap A_2 \cap A_3|$$

$|A_1|$: Since we cannot use zero, there are four ways of choosing the even digit that occupies both the thousands and hundreds place. There are ten choices for each of the remaining digits. Hence, $|A_1| = 4 \cdot 10 \cdot 10 = 400$.

$|A_2|$: Since we cannot use zero, the thousands place can be filled in nine ways. There are five ways to choose the even digit that fills both the hundreds and tens places. There are ten ways to fill the units place. Hence, $|A_2| = 9 \cdot 5 \cdot 10 = 450$.

$|A_3|$: We can fill the thousands place in nine ways and the hundreds place in ten ways. There are five ways to choose the even digit that occupies both the tens and units places. Hence, $|A_3| = 9 \cdot 10 \cdot 5 = 450$.

$|A_1 \cap A_2|$: Since we cannot use zero, there are four ways to choose the even digit that occupies the thousands, hundreds, and tens places. There are ten ways to fill the units place. Hence, $|A_1 \cap A_2| = 4 \cdot 10 = 40$.

$|A_1 \cap A_3|$: There are four ways to choose the even digit that occupies both the thousands and hundreds places and five ways to choose the even digit that occupies both the tens and units places. Hence, $|A_1 \cap A_3| = 4 \cdot 5 = 20$.

$|A_2 \cap A_3|$: There are nine ways to fill the thousands place. There are five ways to choose the even digit that occupies the hundreds, tens, and units places. Hence, $|A_2 \cap A_3| = 9 \cdot 5 = 45$.

$|A_1 \cap A_2 \cap A_3|$: Since we cannot use zero, there are four ways to choose the even digit that occupies the thousands, hundreds, tens, and units places. Hence, $|A_1 \cap A_2 \cap A_3| = 4$.

Therefore, the number of four-digit positive integers that do contain consecutive even equal digits is \begin{align*} |A_1 \cup A_2 \cup A_3| & = |A_1| + |A_2| + |A_3| - |A_1 \cap A_2| - |A \cap A_3| - |A_2 \cap A_3| + |A_1 \cap A_2 \cap A_3|\\ & = 400 + 450 + 450 - 40 - 20 - 45 + 4\\ & = 1199 \end{align*} Therefore, the number of four-digit positive even integers that do not contain consecutive equal even digits is $9000 - 1199 = 7801$.

• Thanks for pointing the errors and nice step by step solution. – rugi Jul 31 '17 at 9:05

This where you're making a mistake $-$

What you're trying to do is called the inclusion-exclusion principle. Your error is in the fact that you are overcounting numbers such as $4446$. If I understand your method correctly, you are blacklisting this number twice instead of once.

IMO, an easier way to solve the problem is to count the numbers that are not to be included first by going through all possible digit combinations e.g. $aabb$ etc.