There are possible -letter strings in which each letter is either an or a . Find the number of such strings that do not have more than adjacent letters that are identical.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
We can define the number of n-letter strings that contain no more than three a ′ s or b ′ s in a row as s n . We can piece together that s 1 = 2 , s 2 = 4 , s 3 = 8 , and since there are 2 3-letter strings that contain 3 a ′ s and 3 b ′ s , then s 4 = 1 6 − 2 = 1 4 .
Looking at our sequences, to find the value of s n , we can tack on either an a or a b at the end of our previous sequence. This however wont always work. If s n − 1 ends in 3 a ′ s or b ′ s in a row, then only one of the two letters will work. Given any sequence of length n − 4 , we can always add three of whatever letter that sequence doesn't end in, so there are s n − 4 sequences such that we can only add on one of the two letters at the end.
This gives us the formula s n = 2 s n − 1 − s n − 4 and using the above information, we can eventually arrive at the answer of 5 4 8