# Nine digit sequences with exactly one zero, two ones, three twos

I'm working on a problem where I am to find the number of nine digit sequences when there are exactly one zero, two ones and three twos. I worked up a solution, but is it correct? Here's my line of thinking:

There are six fixed numbers, which leaves three free. These free can be 3, 4, ..., 9. They can be chosen in $7^3$ different ways. As order matters, 9 objects may be permuted in $9!$ ways. However, there are two ones and three twos, which forces us to divide by $2!3!$. All in all, this gives us

$$\frac{7^3 9!}{2!3!}$$

This is under the assumption that a zero can come first. The question doesn't address this, but if it cannot then we have the same situation as above only that the zero must not come first. So from $\frac{7^3 9!}{2!3!}$ we need to subtract the disallowed situations. Fixing the first number to zero leaves us 8 numbers to permute giving a final count of:

$$\frac{7^3 9!}{2!3!}-\frac{7^3 8!}{2!3!}=\frac{7^3}{12}\left(9!-8!\right)$$

Is this correct? Am I missing something? As I wrote it down here I realized I should probably divide by something more -- don't I, for example, need to account for the cases when the free digits are not unique?

-

The positions for the symbols in $\{0,1,2\}$ can be chosen in $\binom{9}{6}=84$. Once chosen, the symbols $0,1,1,2,2,2$ can be arranged in those cells in $\binom{6}{1,2,3}=60$ ways, using the multinomial coefficient.

The remaining $3$ cells must be assigned symbols from $\{3,4,\ldots,9\}$, which can be achieved in $7^3$ ways.

So, in total we have $$\binom{9}{6}\binom{6}{1,2,3}7^3=1728720$$ such sequences.

-
Iam i correct we seem to differ –  Willemien Sep 11 '13 at 17:42
@Willemien no you have the same answers. ${n \choose 6}{6 \choose 1, 2, 3}7^3=\frac{9!}{6!3!}\frac{6!}{1!2!3!}7^3=\frac{9!7^3}{2!3!3!}$ which you also got. Thanks both of you! –  hejseb Sep 13 '13 at 8:35

sorry you are missing something

see it as 4 groups

• one 0
• two 1
• three 2
• tree others

for the 3 others there are $7^3$ possibilities
and for the groups

$$\frac{ 9!}{2!3!3!}$$

so in total $$\frac{7^3 9!}{2!3!3!}$$

(you are a factor 6 off)

if the first number cannot be 0 , multiply it by 8 divide by 9.

Good luck

-