# How many $n$ digit numbers can be written using only certain digits?

For example, how would I calculate how many $5$ digit numbers I can write using only digits $0, 2, 2, 3, 3$?

Is $4\times5\times5\times5\times5$ correct or am I missing something?

• Does for example 02233 count as a 5 digit number? Or is that a four digit number? – Harald Hanche-Olsen Jan 7 '14 at 22:50
• So each number you create has to use 2 2's, 2 3's, and 1 0? – Mike Jan 7 '14 at 22:51
• Nope, I don't think 02233 is a number. – Tool Jan 7 '14 at 22:52
• What about 33333? I assume no, but it would be less clear if those digits were all different. – Mike Jan 7 '14 at 22:59

## 3 Answers

Total non similar combinations possible=$\dfrac{5!}{2!\cdot 2!}=30$

Number of combinations where digit "$0$" is at start(assuming $02233$ isn't a 5-digit number for instance)=$\dfrac{4!}{2!\cdot 2!}=6$

Number of valid 5-digit numbers=$30-6=24$

Note: If "$0$" is allowed at the start of a number, the answer is $30$.

Since 0 isn't allowed as a leading digit, you have 4 choices for where to put it, and then you have $\binom{4}{2}=6$ choices for where to place the 2's;

so there are $4\cdot6=24$ possible 5-digit numbers.

The reason that 4×5×5×5×5 is the wrong answer is because it will have duplicates in it. How? Here's how

Let's assume we take 2 0 2 3 3 as first number, now if I change the first and second 2 I still get the same number, i.e. 2 0 2 3 3. Hence with your answer, you are considering all these numbers as the different ones. To get the correct answer, K Rmth's answer is good enough.