How many four digits numbers are there that have unique digits and contain the number 21 somewhere in the arrangement?
8C2 * 3!
$${\left({\frac{{\mathtt{8}}{!}}{{\mathtt{2}}{!}{\mathtt{\,\times\,}}({\mathtt{8}}{\mathtt{\,-\,}}{\mathtt{2}}){!}}}\right)}{\mathtt{\,\times\,}}{\mathtt{3}}{!} = {\mathtt{168}}$$
This allows a leading zero.
the 21 must stay as 21, the digits must be adjacent and the order CANNOT be reversed.
This isn't the fastest way to do it....but let's see if we can discover what the answer might be.....let's assume a number can't start with zero....I'm also assuming that the 2 and the 1 can be separated......this may or may not be the correct assumption....
Let's suppose that the 2 and 1 came first.....then we have 10 ways to fill the third posiition and 10 ways to fill the last position = 100
And if the 1 is shifted to the right one position we again have 100 possibilities - 10 ways to fill the second position and 10 ways to fill the 4th position - and if it's the last number that's 100 more.
So, when the 2 occupies the first position, we have 300 possibilities
Now, assuming that a number can't start with zero, let the 2 and 1 occupy the second and third positions. Then we have 9 x 10 = 90 ways to fill the other two positions - 9 ways for the first position times 10 ways for the last position. And this is true again if the 2 occupies the second position and the 1 occupies the last position.
And if the 2 and 1 occupy the last two positions, we again have 9 x 10 = 90 more possibilities.
So the total number would be 3x100 + 3x90 = 570
As an addendum to my above answer.... let's suppose that the 2 and 1 have to be together..........if we allowed for leading zeroes in both of the first two positions....we would have 300 possibilites.
If we didn't allow for a leading zero in the first position, we would have 100 + 90 + 90 = 280 possibilities.
Chris, this is one of your statements
"if we allowed for leading zeroes in both of the first two positions."
The question states that the digits must be unique.
I am standing by my answer.