# How many $8$-digit numbers formed using the digits from $1$ to $9$ have exactly $5$ consecutive even digits and exactly two odd digits?

Suppose an $8$-digit number will be formed using the digits from $1$ to $9$. Find the cardinality when exactly $5$ consecutive digits are even and exactly $2$ digits are odd, e.g., $18242674$, $26682523$

I thought of dividing it into four subgroups, the five consecutive even integers, the two odd numbers, and the other even integer. ie, $(4!) (4)^5 \times (5)^2 \times (4)^1$. I plan to use this cardinality for the classical approach of a prob. Thanks.

• Well, there aren't very many places to put the block of $5$. Just count each possible pattern. – lulu Oct 2 '17 at 13:08
• Your examples have only one odd digit. – N. F. Taussig Oct 2 '17 at 14:14
• There are two odd digits in each example – J. Gielgud Oct 2 '17 at 16:38

Such numbers take one of the following four forms: $$\mathtt{EEEEEOXX} \quad \mathtt{OEEEEEOE} \quad \mathtt{EOEEEEEO} \quad \mathtt{XXOEEEEE}$$ where $\mathtt{E}$ denotes an even digit, $\mathtt{O}$ denotes an odd digit, and $\mathtt{XX}$ denotes a pair of digits in which one is even and one is odd.

There are the same number of numbers taking the first and fourth forms, and the same number of numbers taking the second and third forms. It's now over to you to count how many numbers of each form there are (it's not too hard).

• Perhaps $\mathtt{EEEEEOOE}, \mathtt{EEEEEOEO}, \mathtt{OEEEEEOE}, \mathtt{EOEEEEEO}, \mathtt{EOOEEEEE}, \mathtt{OEOEEEEE}$ is easier since they all have equal cardinality – Henry Oct 2 '17 at 13:28
• @Henry: That's a much nicer approach! – Clive Newstead Oct 2 '17 at 13:47