A sequence of $n$ characters, consisting of the characters $A$, $B$, $C$, $D$; how many sequences of length $n$ exist without three consecutive characters being identical?
This problem was part of a set of programming problems whose solutions were based on counting principles. Input: N Output: number of strings corresponding to above condition
To simplify the output, we were required to give the result modulo some specifc number as the output, but that's probably an irrelevant detail.
My first thought was inclusion-exclusion, but I couldn't figure out the solution. Can anyone provide any insight?
Example: Input: N = 3 Output: Count = 60 Justification: 4^3 - {$AAA$, $BBB$, $CCC$, $DDD$} = 64 - 4 = 60