How many distinct 12-letter “words” are able to be formed from the string of letters “ABBBBBBBBBBBBBBBBBCDEFGHIJKLMOPQRSTUVWXYZ”

combinationscombinatorics

So this is a follow up on a previous question I asked. Previously, I was asking how many ways there were to take a 4-letter "word" from the word BUBBLES, where two Bs are indistinguishable. If you want to take a look at that post, here is the link: How many ways are there to organize the letters in the word BUBBLES into a 4-letter permutation? . Now I wanted to see a more general formula for these kinds of problems, so I figured a new post with a bit more of a complex example would help to bring some attention to it (and someone also suggested this in a comment to that previous post). The new question goes as follows:

Given the string of letters ABBBBBBBBBBBBBBBBBCDEFGHIJKLMOPQRSTUVWXYZ (that's 17 Bs and the other 25 letters of the alphabet), how many distinct ways are there to pick a string of 12 letters from it? Assume that order (so AB is different from BA) and letter (so the letters A and B are able to be told apart from each other) is the only distinguishing factor (i.e. two Bs are the same as each other).

So far, I've taken a look at a few scenarios for this. The thing that I figured would be most important is the amount of Bs that would end up going in the final 12-letter word, so I took a look at that first. Now if we start at all 12Bs going into the word (the absolute maximum), we can only get $1$ possibility. But if we drop a B, lowering the count to 11Bs, then we will have one extra spot for another letter. I figured this spot could take on any of the $12$ spaces between or besides the 11Bs, and would have to be one of the $25$ remaining letters, so $12 \cdot 25$. But from here, I can proceed to get more casework, but I'm not sure that's very feasible here. And I am not seeing an obvious formula that I can derive from those steps. Does anyone have any formulas or ideas to solve this problem? And if so, is there a specific explanation behind it or even a way to derive it?

Best Answer

Suppose that your word contains $i$ B's. There are then $\binom{25}{12-i}$ ways to select the other letters to use. Then there are $12!/i!$ ways of ordering the $12-i$ distinct letters and the $i$ copies of B. Thus, there are a total of $$\frac{25!}{(12-i)!(13+i)!} \cdot \frac{12!}{i!}$$ words of this form.

We wish to find $$\sum_{i=0}^{12} \frac{25! \cdot 12!}{(12-i)!(13+i)!i!}.$$

Unfortunately, such a sum does not have a simple closed form. You may find a (terrible) 'closed form' in terms of hypergeometric functions, but the most efficient way I can see to evaluate this sum is to just do it.