# $AAAPPPLMNOOXQSDF$ number of anagrams such that there aren't three consecutives letters that are the same [closed]

$AAAPPPLMNOOXQSDF$

I would like to calculate thenumber of anagrams such that there aren't three consecutives that are the same. Yet I don't really know how to proceed any ideas ?

## closed as off-topic by Namaste, NCh, Frits Veerman, kingW3, ArnaldoMay 31 '17 at 12:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Namaste, NCh, Frits Veerman, kingW3, Arnaldo
If this question can be reworded to fit the rules in the help center, please edit the question.

• Can you compute the total number of anagrams? Now consider the A's as a block and compute the number. Subtract these. Also subtract the number with the P's as a block. The ones with both the A's and P's as a block.... – Ross Millikan May 29 '17 at 16:34
• ...and add that last number ! – Evargalo May 29 '17 at 16:35

## 2 Answers

First find that there are $\frac{16!}{3!3!2!}$ anagrams, then subtract those having consecutive $A$'s. You can calculate their number pretending that the three $A$'s are a single letter. So $-\frac{14!}{3!2!}$. Do this again for the $P$'s. But this way you have subtracted twice the anagrams having both $A$'s and $P$'s grouped, that have to be added in back: $+\frac{12!}{2!}$. All in all: $$\frac{16!}{3!3!2!}-2\times\frac{14!}{3!2!}+\frac{12!}{2!}$$

• Thank you, great explanation ! – J. OK May 29 '17 at 16:55

Since there's only two letters that are repeated $3$ times one can use the inlcusion/exclusion principle without too much hassle:

There's $\dfrac{16!}{3!3!2!}$ total anagrams, out of those $\dfrac{14!}{3!2!}$ contain the block $AAA$ and $\dfrac{14!}{3!2!}$ contain the block $PPP$, but we've double counted some, since $\dfrac{12!}{3!2!}$ contain both blocks.

The total amount is thus:

$$\dfrac{16!}{3!2!} - 2\dfrac{14!}{3!2!} + \dfrac{12!}{3!2!}$$

• Great explanation ! – J. OK May 29 '17 at 16:55