permutations of a multiset
How many different ways can you arrange the letters of the word MISSISSIPPI? If all 11 letters were distinct you would say 11!. But they are not: there are 4 I's, 4 S's, 2 P's, 1 M. Swapping two of the identical I's does not produce a new visible word, so 11! over-counts massively. Counting arrangements when some items repeat is the job of the multiset permutation formula.
Here is the fix in words: start with n! as if everything were distinct, then DIVIDE OUT the repeats. For each group of identical items of size k, you have secretly multiplied in k! interchangeable orderings of that group, so you divide by k!. With counts n1, n2, ..., nr (summing to n) of each distinct kind, the number of distinct arrangements is n! / (n1! times n2! times ... times nr!). For MISSISSIPPI that is 11! / (4! 4! 2! 1!) = 34650. A quick sanity check: with no repeats every ni! is 1 and the formula collapses back to plain n!.
This number is exactly the multinomial coefficient — the same object that counts how to split n items into labelled groups of sizes n1, ..., nr, and the same coefficients in the multinomial theorem. The everyday name is the 'anagram count'. Watch the common slip: divide by the FACTORIALS of the repeat counts, not by the counts themselves (MISSISSIPPI uses 4! not 4), and only divide for items that are genuinely indistinguishable.
How many arrangements of the letters in BANANA? Counts: 3 A's, 2 N's, 1 B, with 6 letters total. Answer: 6! / (3! 2! 1!) = 720 / (6 times 2) = 60. By contrast, arranging the 6 distinct letters of NUMBER gives 6! = 720, since nothing repeats.
Divide n! by the factorial of each repeat count: n!/(n1! n2! ... nr!).
Divide by the factorials of the repetition counts, never by the raw counts. And this only applies to items that are truly identical — if the two A's were coloured differently they would be distinguishable and you would be back to n!.