How many words?

What is the number of different letter combinations (words) over the alphabet A , C , G , T A, C, G, T of length 8 8 , such that there are no 2 2 consecutive A A 's.


Examples of valid letter combinations: A G C C C A G A AGCCCAGA , G G C T C A G A GGCTCAGA , G G G G G G G G GGGGGGGG .

Examples of invalid letter combinations: C G A A T G A T CGAATGAT , T G A A A T A T TGAAATAT , A C T ACT .


Bonus: Find a closed formula in terms of the word length.


The answer is 44631.

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.

1 solution

Mark Hennings
Apr 25, 2021

Let X n X_n be the number of valid n n -letter words (i.e. with no consecutive A A s). Then X 0 = 1 X_0 = 1 and X 1 = 4 X_1 = 4 . Suppose now that n 2 n \ge 2 . If the first letter of the word is A A , then the second letter must be one of C , G , T C,G,T , and the remaining n 2 n-2 letters must form a valid word. Thus there are 3 X n 2 3X_{n-2} valid n n -letter words beginning with A A . If the first letter of a word is not A A , then the remaining n 1 n-1 letters must form a valid word. Thus there are 3 X n 1 3X_{n-1} valid n n -letter words not beginning with A A . Hence X n = 3 X n 1 + 3 X n 2 n 2 X_n \; =\; 3X_{n-1} + 3X_{n-2} \hspace{2cm} n \ge 2 From this it is easy to calculate that X 8 = 44631 X_8 = \boxed{44631} .

More generally, expressions of the form X n = u n X_n = u^n will satisfy the recurrence relation provided that u 2 3 u 3 = 0 u^2 - 3u - 3 = 0 , and so u = 1 2 ( 3 ± 21 ) u = \tfrac12(3 \pm\sqrt{21}) . Since X 0 = 1 X_0=1 and X 1 = 4 X_1=4 we deduce that X n = 1 3 21 [ ( 3 + 21 2 ) n + 2 ( 3 21 2 ) n + 2 ] n 0 X_n \; = \; \frac{1}{3\sqrt{21}}\left[\left(\frac{3 + \sqrt{21}}{2}\right)^{n+2} - \left(\frac{3-\sqrt{21}}{2}\right)^{n+2}\right] \hspace{2cm} n \ge 0

Just trying to understand this elegant solution (as compared to mine cumbersome case work ...), why would a n=0 letter word be a valid word (a word without letters), and why would there be 4 valid one-letter words and not 3 (aaaaaaaa should not be valid)?

Gediminas Sadzius - 1 month, 2 weeks ago

Log in to reply

“A” is a one letter word with no consecutive As. There is only one way to do nothing, so X 0 = 1 X_0=1 . If you prefer, work with X 2 = 15 X_2=15 instead...

Mark Hennings - 1 month, 2 weeks ago

Perfect! As always ;)

Simon Kaib - 1 month, 2 weeks ago

Yes, this is perfect as always! (from another cumbersome case work solver of 0, 1, 2, 3 and 4 A(s) in the words).

Saya Suka - 1 month, 1 week ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...