Question 5
Consider the task of counting how many sequences of length exist consisting only of numbers , , and such that each number occurs at least once. We will solve this by calculating the number of sequences which do not contain at least one of the numbers.
Let's denote by the set of sequences in which the digit does not occur. The formula of inclusion-exclusion on the number of "bad" sequences is given by:
Based on the above data, answer the given subquestions.
For n = 4, calculate the number of sequences of length 3 consisting only of numbers 0, 1, and 2 such that each number occurs at least once.