Solution 1
For each Bauman string of length 5 in which the first and last
letters are both A, the second and
fourth letters are not A.
For such Bauman strings, either the third letter is A, or the third letter is not A.
Case 1: The third letter is A.
In this case, the string is of the form AAA.
There are 4 choices for the second letter (B,C,D, or E) and 4 choices for the fourth letter,
and so there are 4×4=16 such
Bauman strings.
Case 2: The third letter is not A.
In this case, the string is of the form AxA, where the
third letter x is B,C,D, or E, and so there are 4 choices for the
third letter.
The second letter must be different than the third letter and must not
be A, and so there are 3 choices
for the second letter.
Similarly, there are 3 choices for the fourth letter, and so there are
4×3×3=36 such Bauman
strings.
In total, the number of Bauman strings of length 5 in which the first
and last letters are both A is
16+36=52.
Solution 2
For each Bauman string of length 5 in which the first and last
letters are both A, either the
second and fourth letters are the same, or they are different.
Case 1: The second and fourth letters are the same.
In this case, the string is of the form AxxA.
There are 4 choices for the second letter (B,C,D, or E) and 1 choice for the fourth letter
since it is the same as the second letter.
The third letter must be different than the second and fourth letters
(which are the same) and so there are 4 choices for the third
letter.
Thus, there are 4×1×4=16
such Bauman strings.
Case 2: The second and fourth letters are different.
In this case, the string is of the form AxyA, where x and y represent different letters.
There are 4 choices for the second letter (B,C,D, or E) and 3 choices for the fourth letter
(it is different than the second letter and not A).
The third letter must be different than the second and fourth letters
(which are different) and so there are 3 choices for the third
letter.
Thus, there are 4×3×3=36
such Bauman strings.
In total, the number of Bauman strings of length 5 in which the first
and last letters are both A is
16+36=52.
Solution 1
We may determine the number of Bauman strings of length 6 that
contain more than one B
indirectly.
That is, we may subtract the number of Bauman strings that contain 0
B’s and the number of Bauman
strings that contain exactly 1 B
from the total number of Bauman strings of length 6.
For a Bauman string of length 6 (with no restrictions), there are 5
choices for the first letter and 4 choices for each of the remaining
letters, and so there are a total of 5×45=5120 such strings.
For a Bauman string of length 6 that contains 0 B’s, there are 4 choices for the first
letter and 3 choices for each of the remaining letters, and so there are
a total of 4×35=972 such
strings.
Next, we count the number of Bauman strings that contain exactly 1
B.
If the first letter of the string is a B, then there are 4 choices for the
second letter and 3 choices for each of the remaining four
letters.
Similarly, if the last letter is a B, then there are 4 choices for the
letter adjacent to the B and 3
choices for each of the remaining four letters.
Thus, there are 1×4×34=324 strings that begin
with a B and 324 strings that end
with a B.
If the second letter of the string is a B, then there are 4 choices for the first
letter, 4 choices for the third letter, and 3 choices for each of the
fourth, fifth and sixth letters.
Thus, there are 4×1×4×33=432 such
strings.
Similarly, if the third, fourth or fifth letter in the string is a B, then there are 432 such strings.
In total, there are 5120−972−2×324−4×432=1772
Bauman strings of length 6 that contain more than one B.
Solution 2
A Bauman string of length 6 cannot contain more than 3 B’s (confirm for yourself why this is
true before proceeding).
We may determine the number of Bauman strings of length 6 that contain
more than one B directly.
That is, we may count the number of strings that contain exactly 3 B’s and the number of strings that
contain exactly 2 B’s.
Thus, there are two cases to consider.
Case 1: The Bauman string has exactly 3 B’s
In this case, the string must take one of four possible forms: BBB, BBB, BBB, BBB. We begin by counting the number of strings of the form
BBB.
There are 4 choices for the second letter (A,C,D, or E), 4 choices for the fourth letter, and
4 choices for the sixth letter, and so there are 43=64 such strings.
Similarly, there are 43=64 strings
of the form BBB.
It is worth noting that BBB and $BB
}B$ have identical forms when one is read left to right and the
other right to left.
We may call such pairs of forms symmetric, and recognize that
under the same restrictions, symmetric forms have an equal number of
Bauman strings.
For strings of the form BBB, there are 4 choices for the
second letter, 4 choices for the fourth letter, and 3 choices for the
fifth letter (since the fifth letter must be different than B and different than the fourth letter,
which is not B), and so 42×3=48 such strings.
Since BBB is symmetric to BBB, there are similarly 42×3=48 strings of this form.
Thus, there are 2×64+2×48=224 Bauman strings
with exactly 3 B’s.
Case 2: The Bauman string has exactly 2 B’s
In this case, the string must take one of ten possible forms.
Eight of these occur in one of the following four symmetric pairs BB and BB, BB and BB,
BB and BB, BB and BB and
the final two forms (which are not a symmetric pair) are BB and BB. We begin by counting the number of strings of
the form BB.
There are 4 choices for the second letter (A,C,D, or E), 4 choices for the fourth letter,
3 choices for each of the fifth and sixth letters, and so there are
42×32=144 such
strings.
Similarly, there are 42×32=144 strings for each of the
next five forms listed above, $BB,BB,BB, \, BB, and }
BB$.
For strings of the form BB, there are 4
choices for the first letter, 4 choices for the third letter, 4 choices
for the fifth letter, and 3 choices for the sixth letter, and so there
are 43×3=192 such
strings.
Since BB is symmetric to BB, there are similarly 43×3=192 strings of this form.
Finally, there are 4×33=108 strings of the form BB, and 43×3=192 strings of the form BB.
Thus, there are $6×144+2×192+
108+192 =1548 Bauman strings with exactly 2 B$’s.
In total, there are 224+1548=1772 Bauman strings of length 6
that contain more than one B.
Solution 1
Consider all Bauman strings of length n that begin with C.
There are 4 choices for each of the remaining n−1 letters, and so there are 4n−1 such Bauman strings.
Each of these strings either ends with D, or it does not end with D.
We call those that end with D,
dn, and we define ∣dn∣ to be the number of such
strings.
Similarly, we call those that do not end in D, xn, and we define ∣xn∣ to be the number of such
strings.
For example, d1 represents the
Bauman strings of length 1 that
begin with C and end with D, and since no such string exists, then
∣d1∣=0.
Similarly, x1 represents the
Bauman strings of length 1 that
begin with C and do not end with
D, and so ∣x1∣=1 (the string is C).
We may confirm that 4n−1=∣dn∣+∣xn∣ when n=1, since 41−1=∣d1∣+∣x1∣=0+1.
Further, we know that ∣d2∣=1 (the
string is CD), and ∣x2∣=3 (the strings are CA, CB, CE), and again confirm that 42−1=1+3.
Next, consider the Bauman strings of length n that begin with C and do not end with D, that is, xn.
Each of these strings could have a D added to its end to form a Bauman
string of length n+1 that begins
with C and ends with D, or dn+1.
Since adding a D to the end of
every string xn gives all possible
strings dn+1, then ∣dn+1∣=∣xn∣.
From our earlier work, we may confirm that ∣d2∣=∣x1∣=1.
Further, $|x_{n+1}| = 4|d_n| +
3|x_n|$. Why is this true?
Every Bauman string of length n+1
that begins with C and does not end
with D, that is xn+1, is either a string dn with an A, B, C, or E added to its end, or it is a string
xn that has a choice of 3 letters
added to its end (the letter added can not be D and it can not be the last letter of
xn, leaving 3
possibilities).
The number of strings dn that have
A, B, C, or E added to its end is 4∣dn∣.
The number of strings xn that have
a choice of 3 letters added to its end is 3∣xn∣.
Therefore, we conclude that $|x_{n+1}| =
4|d_n| + 3|x_n|$.
From our earlier work, we may confirm that ∣x2∣=4∣d1∣+3∣x1∣=4(0)+3(1)=3.
We use these two formulas $|d_{n+1}| =
|x_n|and|x_{n+1}| = 4|d_n| +
3|x_n|,whichareequivalentto|d_{n}| = |x_{n-1}|and|x_{n}| = 4|d_{n-1}| + 3|x_{n-1}|$, to
build the table below.
n
∣dn∣=∣xn−1∣
∣xn∣=4∣dn−1∣+3∣xn−1∣
1
∣d1∣=0
∣x1∣=1
2
∣d2∣=1
∣x2∣=3
3
∣d3∣=∣x2∣=3
$|x_3|=4|d_{2}| +
3|x_{2}|=4(1)+3(3)=13$
4
∣d4∣=∣x3∣=13
$|x_4|=4|d_{3}| +
3|x_{3}|=4(3)+3(13)=51$
5
∣d5∣=51
∣x5∣=4(13)+3(51)=205
6
∣d6∣=205
∣x6∣=4(51)+3(205)=819
7
∣d7∣=819
∣x7∣=4(205)+3(819)=3277
8
∣d8∣=3277
∣x8∣=4(819)+3(3277)=13107
9
∣d9∣=13107
∣x9∣=4(3277)+3(13107)=52429
10
∣d10∣=52429
not needed
Therefore, the number of Bauman strings of length 10 in which the first letter is C and the last letter is D is 52 429.
Solution 2
Let Sn be the set of Bauman
strings of length n in which the
first letter is C and the last
letter is D.
Further, we define ∣Sn∣ to be
the number of such strings.
For example, S2={CD} and so
∣S2∣=1, and S3={CAD,CBD,CED} and so ∣S3∣=3.
Each string in S10 is of the
form CD or CT8D where T8 is a Bauman string of length 8 that
does not begin with C and does not
end with D.
Therefore, ∣S10∣=∣T8∣. The
number of such strings, ∣T8∣, is
equal to −−+the total number of Bauman strings of length 8the number of Bauman strings of length 8 that begin with Cthe number of Bauman strings of length 8 that end with Dthe number of Bauman strings of length 8 that begin with C and end with D In the above, we note that strings beginning with
C include those that end with D, as well as others.
Similarly, strings that end with D
include those that begin with C, as
well as others.
Since we have subtracted the number of strings that begin with C and end with D twice from the total, we conclude by
adding the number of such strings.
For a Bauman string of length 8, there are 5 choices for the first
letter and 4 choices for each of the remaining 7 letters.
Thus, the total number of Bauman strings of length 8 is equal to 5×47.
For a Bauman string of length 8 that begins with C, there is 1 choice for the first letter
and 4 choices for each of the remaining 7 letters.
Thus, the total number of Bauman strings of length 8 that begin with
C is equal to 1×47.
Also, the total number of Bauman strings of length 8 that end with D is equal to 1×47.
The number of Bauman strings of length 8 that begin with C and end with D is equal to ∣S8∣.
Therefore, we get ∣S10∣=∣T8∣=5×47−1×47−1×47+∣S8∣=3×47+∣S8∣
and so the number of Bauman strings of length 10 that begin with C and end with D is dependent on the number of Bauman
strings of length 8 that begin with C and end with D.
At this point, we could repeat the process above to determine ∣S8∣, however it may be more efficient
to generalize the work above to determine a formula for ∣Sn∣.
For integers n≥3, each string
in Sn is of the form CTn−2D where Tn−2 is a Bauman string of length
n−2 that does not begin with C and does not end with D.
The number of such strings, ∣Tn−2∣, is equal to −−+the total number of Bauman strings of length n−2the number of Bauman strings of length n−2 that begin with Cthe number of Bauman strings of length n−2 that end with Dthe number of Bauman strings of length n−2 that begin with C and end with D For a Bauman string of length n−2, there are 5 choices for the first
letter and 4 choices for each of the remaining n−3 letters.
Thus, the total number of Bauman strings of length n−2 is equal to 5×4n−3.
For a Bauman string of length n−2
that begins with C, there is 1
choice for the first letter and 4 choices for each of the remaining
n−3 letters.
Thus, the total number of Bauman strings of length n−2 that begin with C is equal to 1×4n−3.
Also, the total number of Bauman strings of length n−2 that end with D is equal to 1×4n−3.
The number of Bauman strings of length n−2 that begin with C and end with D is equal to ∣Sn−2∣.
Therefore, we get ∣Sn∣=∣Tn−2∣=5×4n−3−1×4n−3−1×4n−3+∣Sn−2∣=3×4n−3+∣Sn−2∣, for integers n≥3. Using this recursive formula
and the fact that ∣S2∣=1, we get
∣S4∣∣S6∣∣S8∣∣S10∣====3×44−3+∣S4−2∣3×46−3+∣S6−2∣3×48−3+∣S8−2∣3×410−3+∣S10−2∣====3×4+∣S2∣3×43+∣S4∣3×45+∣S6∣3×47+∣S8∣====13205327752429 The number of Bauman strings of length 10 in which the first letter is C and the last letter is D is 52 429.