How to count the number of strings of length 5 in which at least one symbol occurs two or more times.

1.7k Views Asked by At

Suppose that A is a set of 8 (distinct) symbols and consider strings (i.e. sequences) over A.

How can I calculate the number of strings of length 5 which at least one symbol occurs two or more times. I started by calculating the total number of strings of length 5 by doing $8^5$ ( since we have 8 choices for each number) and then I subtracted the amount of strings of length 5 that do not have any repetition ($ 8\times 7\times 6\times 5 \times 4$) and I got the wrong answer. I think this is because my logic is wrong. Can someone help me?

1

There are 1 best solutions below

0
On

Ok so it turns out my answer was correct and my professor was mistaken. The answer is 26048. The way I got to this number is explained in my question.