Counting permutation of duplicate items I am not really sure I fully understand the formula for finding the number of permutation of duplicate items.
The formula is:
$$\frac{n!}{p!q!r!\cdots}$$
Where do the factorials in the denominator exactly come from?
If we asssume the string "ANNA" and we want the count of the permutation of duplicate items.
We have $4$ characters so since we have $4$ options for the first character, $3$ for the second, $2$ for the third and $1$ for the last we have $4!$ different permutations.
But some of the characters are duplicates.
We have "A" and "N" repeated, meaning it adds more permutations to the outcome.
If $p=2$ is the number of occurences of "A" and if $q = 2$ is the number of occurences for "N"  then would the $p!$ and $q!$ essentially be selecting $1$ item at a time from $2$ (or $p$) duplicates? So essentially are the denominators the binomial $\binom{2}{1}$ (or generally $\binom{p}{1}$ where $p$ are the number of repeated characters) where order does not matter?
Is my understanding correct?

The first part giving $4!=24$ different permutations of $4$ distinct objects is fine.
Now we consider the word $ANNA$ where we have two letters of one kind $A$ and two letters of another kind $N$.

*

*Let $x$ denote the number of different permutations we can obtain from the letters $A,A,N,N$.


*Suppose the $2$ letters $A$ are replaced by $2$ new letters, distinct from each other and from all other letters being permuted. These $2$ new letters may be permuted in $2!$ ways; hence the number of permutations of the new set of objects is $x\cdot 2!$.


*Next suppse the $2$ letters $N$ are replaced by $2$ new letters, distinct from each other and from all other letters being permuted. These $2$ new letters may be permuted in $2!$ ways; hence the number of permutations of the new set of objects is $x\cdot 2! \cdot 2!$.


*Since the number of permutations of $4$ distinct letters is $4!$ we obtain
\begin{align*}
x\cdot 2!\cdot 2!&=4!\\
\color{blue}{x}&\color{blue}{=\frac{4!}{2!2!}}
\end{align*}
Doing the same approach with $p$ equal objects of one kind, $q$ equal objects of another kind, and so on, we obtain in general
\begin{align*}
\frac{n!}{p!q!\cdots}
\end{align*}
with $p+q+\cdots =n$.
