QUESTION
The Fibonacci strings are defined as follows:
s1 = b, s2 = a, and sk = sk-1sk-2fork > 2.
For example, s3 = ab, s4 = aba, and s5 = abaab.
a) What is the length of s10?
b) What is the length of sn?
ANSWER
a) What is the length of s10?
S1 | b | b |
S2 | a | a |
S3 | S3 = S(3-1)S(3-2) = S2S1 | ab |
S4 | S4 = S(4-1)S(4-2) = S3S2 | aba |
S5 | S5 = S(5-1)S(5-2) = S4S3 | abaab |
S6 | S6 = S(6-1)S(6-2) = S5S4 | abaababa |
S7 | S7 = S(7-1)S(7-2) = S6S5 | abaababaabaab |
S8 | S8 = S(8-1)S(8-2) = S7S6 | abaababaabaababaababa |
S9 | S9 = S(9-1)S(9-2) = S8S7 | abaababaabaababaababaabaababaabaab |
S10 | S10 = S(10-1)S(10-2) = S9S8 | abaababaabaababaababaabaababaabaababaababaabaababaababa |
b) What is the length of sn?
sn=s(n-1)s(n-2)
No comments:
Post a Comment