TITLE: Permutations with duplicates
QUESTION [8 upvotes]: I have a data set $2\; 3\; 3\; 4\; 4\; 4\; 4$
I want to find the number of unique numbers of $3$ digit numbers that can be formed using this.
I was thinking of doing $\large{\frac{^7P_3}{4!\times 2!}}$, but this doesn't seem right.

REPLY [4 votes]: I answered a similar question here.
Your data set is a multiset that can be written as 
$$
S=(\underbrace{2,\cdots,2 }_{1},\underbrace{3,\cdots,3 }_{2},\underbrace{4,\cdots,4 }_{4})
$$
where the number under the brace is the multiplicity of the element above, wich is the number of instances of the element in the multiset. Lets call the number of digit you need $l$ (in this case $l=3$). Lets call the number of distinct elements of the multiset $n$ (in this case $n=3$) and lets call the multiplicity of the $k_{th}$ element $m_k$ (in this case $m_1=1$, $m_2=2$ and $m_3=4$), what you need are all the combinations of $(x_1,x_2,\dots,x_n)$ where $0 \leq x_k \leq m_k$ so that
$$
\sum_{k=1}^n x_k = l
$$
Lets list all the values that any $x_k$ can have:
$$
x_1=(0,1)
$$
$$
x_2=(0,1,2)
$$
$$
x_3=(0,1,2,3,4)
$$
and, with those values, lets list all their possible combinations, remembering that their sum must be equal to $l$:
$$
C_1=(0,0,3)
$$
$$
C_2=(0,1,2)
$$
$$
C_3=(0,2,1)
$$
$$
C_4=(1,0,2)
$$
$$
C_5=(1,1,1)
$$
$$
C_6=(1,2,0)
$$
Since the sum of the elements of each combination is equal to $l$, you can see each combination as a multiset in wich $l$ is equal to the sum of the multiplicity of each element, so the number of permutations for each combination is
$$
\frac{l!}{x_1!x_2! \dots x_k!}
$$
What remains to do is to sum all the numbers of permutations of each combination to get the final answer, so
$$
\frac{3!}{0!0!3!}+\frac{3!}{0!1!2!}+\frac{3!}{0!2!1!}+\frac{3!}{1!0!2!}+\frac{3!}{1!1!1!}+\frac{3!}{1!2!0!}=1+3++3+3+6+3=19
$$
If you need a deeper explanation of why this works you can check the link above. I came up with this method while working on a project and I'm not a matematician myself, so it could be a bit messy. Sorry in advance.