How many 5-letter strings using only A and B contain no three consecutive A's?
Enter an integer
Show solution
Let an be the count of valid n-letter strings. A valid string can start with B, AB, or AAB, each followed by a valid string. So an=an−1+an−2+an−3. With a1=2, a2=4, a3=7: a4=7+4+2=13, a5=13+7+4=24.