Recurrence relation for the number of strings of length $n$ over the alphabet $\{1, 2,3,4,5,6,7\}$ such that there are no consecutive $1$’s or $2$’s.

combinatorics

Find a recurrence relation for the number of strings of length $n$ over the alphabet $\{1, 2,3,4,5,6,7\}$ such that there are no consecutive $1$'s or $2$'s.

I have no idea where to start. I've been stuck for some time. Any help is appreciated, Thanks.

Best Answer

Make coupled recurrences, one for the number of good strings of length $n$ that do not end in $1$ or $2$ and one for the number of good strings that do end in $1$ or $2$. Given the number of each, how many strings of length $n+1$ of each type are there?