<s>[INST] Counting the number of integers with given restrictions Question: Consider the numbers $1$ through $99,999$ in their ordinary decimal representations. How many contain exactly one of each of the digits $2, 3, 4, 5$?
Answer: $720$.

Attempt at deriving the answer:
We have two cases: four digit numbers and five digit numbers.
Five digit numbers:
Let $x \in \{2, 3, 4, 5\}$. If the first position in a five digit number is not $x$, then there are $5$ possibilities for this position as there are four values for $x$ and $0$ is inadmissable. The rest of the four positions will have the various permutations of four values of $x$. There are $5 \times 4!$ such numbers. If the non-$x$ value is in the second position, then there are $4$ ways to choose an $x$-value for the first position, $6$ integers for the second position and $3!$ permutations for the rest of the positions. There are $4\times 6 \times 3!$ such numbers. If the non-$x$ value is in the third position, then there are $\binom 42$ ways to choose two $x$-values, $2!$ ways to permute them and $6$ integers for the third position meaning there are $6 \times 2 \times 6$ such numbers. When the non-$x$ value is in the fourth position, there are $4 \times 3! \times 6$ such numbers. Finally, if non-$x$ is in the fifth position, there are $4! \times 6$ such numbers.
Four digit numbers:
We just need to permute the number $2345$. There are $4!$ such permutations.
Thus the number of numbers with the given restrictions is $5\times 4! + 4\times 3!\times 6 + 2\times 6 \times 6 + 4 \times 3! \times 6 + 6 \times 4! + 4! = 648$.
What did I forget to take into account? Thanks.
 [/INST] To answer the question you asked: In the case where the non-$x$ value is in the third position, you missed permuting the fourth and fifth digits of the number, so that term should be $6\cdot 2\cdot 6\cdot 2$ (rather than $6\cdot 2\cdot 6$).
</s>