So it is more of a riddle than research-level mathematics, but your help would be hugely appreciated.
Here is the full problem: With the Latin alphabet, how many words are there (counting all of them, even those that don't make sense) of 5 letters that have at least one I and at least two T's, but no K or Y?
I already know the answer because I coded it, but I'm looking for simple math proof. Here is my code.
import itertools
alphabet = string.ascii_uppercase.replace("K", "").replace("Y", "")
count = 0
for word in itertools.product(alphabet, repeat = 5):
if "I" in word and word.count("T") >= 2:
count += 1
print (count)
The code answer is 15645
Thank you so much!
prerequisite :
the number of permutation with n objects of which a are alike , b are alike , c are alike ... is
$$\frac{n!}{(a!*b!*c!*....)}$$
proof:
3 letters for the 5 letter word are fixed i.e (i,t,t)
lets signify all letters other than i,t,k,y using x
for the 2 letters left , we can have seven cases:
case 1 : i,i
case 2 : i,t
case 3 : i,x
case 4 : t,t
case 5 : t,x
case 6 : x,x but both letters are different
case 7 : x,x but both letters are the same
as these are all the cases that exist , the sum of all these cases will give us the answer
case 1 :
the set contan i,i,i,t,t
no of possible permutatons : $$\frac{5!}{(2!*3!)} = 10$$
case 2 :
the set contain i,i,t,t,t
no of possible permutatons :
$$\frac{5!}{(2!*3!)} = 10$$
case 3 :
the set contain i,i,t,t,x (x represent any of the 22 letters)
no of possible permutations : $$\frac{(22*5!)}{(2!*2!)} = 660$$
case 4 :
the set contains i,t,t,t,t
no of possible permutations : $$\frac{5!}{4!} = 5 $$
case 5 :
the set contains i,t,t,t,x
no of possible permutations : $$\frac{(22*5!)}{3!} = 440$$
case 6 :
the set contains i,t,t,x,x (with both x reprsent different letter )
no of possible permutations : $$\frac{({22 \choose 2} *5!)}{(2!)} = 13,860$$
case 7 :
the set contains i,t,t,x,x (both x representing same letter )
no of possible permutations : $$\frac{(22*5!)}{(2!*2!)} = 660$$
sum of all cases : 10 + 10 + 660 + 5 + 440 +13,860 + 660 = 15,645