I am studying for my exam and this is an example I don't understand:
Consider all words in $\{1,2,3\}$ with n characters. We know from combinatorics that there are $3^n$ different words. Question: How many words have at least two consecutive ones?
The recurrence relation is: $A_{n+3} = 3A_{n+2} - 2A_n + 2 \times 3^n$. Can somebody explain this recurrence relation?