How many ways to arrange the letters "muhammadan" so that 2 identical letters do not appear together? The reason I am asking, considering other questions are similar, is because the answer given by the book I am studying (Combinatorics Problems and Solutions by Hollos) is 20,040. But I keep getting 20,160. I am taking the approach of the total ways to arrange the letters minus the forbidden ways: 10!/36 - (2*9!/3! - 8!)
I can't understand how I am allowing 120 forbidden arrangements. I am using the inclusion/exclusion principle with regards to mmm+others, mm+others, aa+others, aaa+others,since they all intersect.
 A: The answer of $24240$ mentioned in the comments is correct. Here is a mathematical approach.
We can use Inclusion-Exclusion to find the number of arrangements.
The total number of ways without restriction is $$\frac{10!}{3! 3!}$$
Now to begin removing all the possibilities of adjacent letters.
One pair of adjacent letters: We can select either the pair $mm$ or $aa$. Therefore the number of ways to arrange with one paired group is $$2 \left( \frac{9!}{3!} \right)$$
Two pairs of adjacent letters: There are two situations where this can happen. We either have two pairs of the same letter (that is, a trio of $m$'s or $a$'s) or we can have one pair of $mm$ and one pair of $aa$ at the same time.
If we have the trio we have two ways to select the trio, then we arrange the trio with the rest of the letters. The number of ways to arrange like this is $$2 \left( \frac{8!}{3!} \right)$$
If we have one pair of each letter, then we can look at it as having $8$ distinct items to be arranged. So the number of ways to do this case is simply $$8!$$
Three pairs of adjacent letters: This can only happen when we have a trio of the one letter and a pair of the other. There are two ways to choose the letter for the trio, then between the trio, the pair, and the remaining letters, it's like arranging $7$ distinct items in a line. So the number of ways for this case is $$2(7!)$$
Four pairs of adjacent letters: This is only possible if we have both a trio of $m$'s and a trio of $a$'s at the same time. Arranging both trios and the remaining letters is like arranging $6$ distinct items. So the number of ways for this case is $$6!$$

Now we can take the total number of ways to arrange without restriction and subtract off the number of ways we have one pair of adjacent letters. But in doing that, we subtract too much off, and need to add back the ways to arrange two pairs of adjacent letters. But we've added too much back now, and need to subtract off again the ways to arrange three pairs of adjacent letters. Finally we need to add back the ways with four pairs of adjacent letters.
Putting it all together we arrive at:
$$\frac{10!}{(3!)(3!)} - \frac{2(9!)}{3!} +\frac{2(8!)}{3!} + 8!  -2(7!) + 6! = 24240$$
A: Let's count the solutions "by hand" and without resort to inclusion/exclusion.
As previously commented it is a shortcut to consider that the roles of $A$ and $M$ are interchangeable, as are the roles of the four distinct letters $D,H,N,U$.  To begin consider the possible arrangements of the repeating letters $A$ and $M$, and restrict ourselves to half of the cases, those where $A$ comes first.  If two $A$'s or two $M$'s are adjacent, one of the four distinct letters will be required in between (for the sake of definiteness, think of it "glued" to the leftmost of those two same letters):
$$ \begin{array}{c|c}
\text{PATTERN} & \text{leftover letters} \\
\hline
\mathtt{A\;A\;A\;M\;M\;M} & 0 \\
\mathtt{A\;A\;M\;A\;M\;M} & 2 \\
\mathtt{A\;A\;M\;M\;A\;M} & 2 \\
\mathtt{A\;A\;M\;M\;M\;A} & 1 \\
\mathtt{A\;M\;A\;A\;M\;M} & 2 \\
\mathtt{A\;M\;A\;M\;A\;M} & 4 \\
\mathtt{A\;M\;A\;M\;M\;A} & 3 \\
\mathtt{A\;M\;M\;A\;A\;M} & 2 \\
\mathtt{A\;M\;M\;A\;M\;A} & 3 \\
\mathtt{A\;M\;M\;M\;A\;A} & 1 \\
\end{array} $$
In the first case we will require all four of the unique letters to separate the adjacent $A$ (resp. $M$) pairs, so there are no "leftover letters".  Naturally the placement of zero things can be done in only one way!
Otherwise some choices are available to place leftover letters.  Places can be chosen from any of seven possibilities, with more than one letter potentially being inserted into such a place.  Thus:
One leftover letter can be inserted in $7$ places.
Two leftover letters can be inserted together in $7$ places or apart in $\binom{7}{2}$ places.
Three leftover letters can be inserted together in $7$ places or two together and one apart in $7\cdot 6$ places or each apart in $\binom{7}{3}$ places.
Four leftover letters can be inserted, by similar logic, in this many places:
$$ 7 + 7\cdot 6 + \binom{7}{2} + 7\cdot \binom{6}{2} + \binom{7}{4} $$
Putting together the number of each kind of case times the number of places:
$$ (1\cdot 1) + (2\cdot 7) + (4\cdot 28) + (2\cdot 84) + (1\cdot 210) = 505 $$
This relatively modest count should then be multiplied by $2\cdot 4!$ to account for the interchangeable roles of $A$ and $M$ and the permutations of the four distinct letters:
$$ 505 \cdot 48 = 24,240 $$
