Suppose that we have a 15-letter alphabet. How many 6 letter words have
exactly 3 consecutive letters the same?
Let variable symbols X,@,# and $ represent any letters in the 15-letter
alphabet.
Note: I will assume XXX@@@ to be acceptable as a 6-letter word having
exactly 3 consecutive letters the same. It has exactly 3 consecutive
letters the same. It doesn't matter that it has 2 different pairs of
exactly 3 consecutive letters the same.*
Case 1: XXX@#$
Case 2: @XXX#$
Case 3: $#XXX@, the reverse of Case 2, and has the same number of words.
Case 4: $#@XXX, the reverse of Case 1, and has the same number of words.
However, when we finish we must subtract from the final figure, the
duplications of cases of XXX@@@.
Case 1: XXX@#$
We can choose the X any of 15 ways.
We can choose the @ any of 14 ways (to prevent 4 consecutiva X's.
We can choose the # any of 15 ways.
We can choose the $ any of 15 ways.
That's 15∙14∙15∙15 = 47250
Case 2: @XXX#$
We can choose the X any of 15 ways.
We can choose the @ any of 14 ways. (to prevent 4 consecutive X's.
We can choose the # any of 14 ways. (to prevent 4 consecutive X's.
We can choose the $ any of 15 ways.
That's 15∙14∙14∙15 = 44100
Case 3: $#XXX@
This is the same as case 2, 44100
Case 4: $#@XXX,
This is the same as case 1, 47250
So for the 4 cases we have 47250 + 44100 + 44100 + 47250 = 182700
However each case of XXX@@@ is counted once in case 1 and once in case 4.
So they are counted twice among the 182700. But we want to count them only
once. So we must subtract them once.
For the case XXX@@@,
There are 15 ways to choose the X and
There are 14 ways to choose the @.
So there are 15∙14 = 210 words that are counted twice among the 182700.
So we must subtract 210 from the 182700
Final answer = 182700-210 = 182490 6-letter words with exactly 3
consecutive letters.
-------
*Note: in the unlikely event that XXX@@@ were not acceptable, then you
would subtract another 210 to eliminate them from the count.
Edwin