What is the number of different letter combinations (words) over the alphabet of length , such that there are no consecutive 's.
Examples of valid letter combinations: , , .
Examples of invalid letter combinations: , , .
Bonus: Find a closed formula in terms of the word length.
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.
Let X n be the number of valid n -letter words (i.e. with no consecutive A s). Then X 0 = 1 and X 1 = 4 . Suppose now that n ≥ 2 . If the first letter of the word is A , then the second letter must be one of C , G , T , and the remaining n − 2 letters must form a valid word. Thus there are 3 X n − 2 valid n -letter words beginning with A . If the first letter of a word is not A , then the remaining n − 1 letters must form a valid word. Thus there are 3 X n − 1 valid n -letter words not beginning with A . Hence X n = 3 X n − 1 + 3 X n − 2 n ≥ 2 From this it is easy to calculate that X 8 = 4 4 6 3 1 .
More generally, expressions of the form X n = u n will satisfy the recurrence relation provided that u 2 − 3 u − 3 = 0 , and so u = 2 1 ( 3 ± 2 1 ) . Since X 0 = 1 and X 1 = 4 we deduce that X n = 3 2 1 1 ⎣ ⎡ ( 2 3 + 2 1 ) n + 2 − ( 2 3 − 2 1 ) n + 2 ⎦ ⎤ n ≥ 0