Here is the problem:

A sequence of letters of the form abcba is an example of a palindrome of five letters.

a. If a letter may appear more than twice, how many palindromes of five letters are there? of six letters?

b. Repeat part a under the condition that no letter appears more than twice.

I do not know how to go about doing this problem. Any help would be appreciated. thanks.

2. Hello, ashkash!

I used Brute Force . . . and started making a list.

A sequence of letters of the form ABCBA is an example of a palindrome of five letters.

(a) If a letter may appear more than twice,
how many palindromes of five letters are there? of six letters?

With five letters, consider the first three letters.

3 different letters: .$\displaystyle ABC\;\;\Rightarrow\;\;ABCBA$

2 different letters: .$\displaystyle \begin{array}{ccc}ABA\;\;\Rightarrow\;\;ABABA \\ AAB\;\;\Rightarrow\;\;AABAA \\ ABB\;\;\Rightarrow\;\;ABBBA\end{array} \begin{array}{ccc}* \\ * \\ *\end{array}$

. . Only one letter: .$\displaystyle AAA\;\;\Rightarrow\;\;AAAAA\;\;\;\:*$

With six letters, again consider the first three letters.

3 different letters: .$\displaystyle ABC\;\;\Rightarrow\;\;ABCCBA$

2 different letters: .$\displaystyle \begin{array}{ccc}ABA\;\;\Rightarrow\;\;ABAABA \\ AAB\;\;\Rightarrow\;\;AABBAA \\ ABB\;\;\Rightarrow\;\;ABBBBA\end{array} \begin{array}{ccc}* \\ * \\ * \end{array}$

. . Only one letter: .$\displaystyle AAA\;\;\Rightarrow\;\;AAAAAA\;\;\;\:*$

(b) Repeat part (a) under the condition that no letter appears more than twice.

Disregard answers in (a) marked with an asterisk $\displaystyle (*).$

3. for the question you need to consider all 26 letters of the alphabet and not just a,b,and c.

4. Originally Posted by ashkash
for the question you need to consider all 26 letters of the alphabet and not just a,b,and c.
Would $\displaystyle AAAAA$ be a valid combination?

5. yes, it would.

6. As soroban pointed out all you have to consider is the first three letters, each is independent of the other...

Here's an example problem. Flip a coin. After one flip you have only two possible outcomes (2^1):

$\displaystyle \boxed{\begin{array}{cc}H\\T\end{array}}$

After two flips you get four possible outcomes (2^2):

$\displaystyle \boxed{\begin{array}{cccc}HH\\HT\\TH\\TT\end{array }}$

After three flips you get eight possible outcomes (2^3):

$\displaystyle \boxed{\begin{array}{cccccccc}HHH\\HHT\\HTH\\HTT\\ THH\\THT\\TTH\\TTT\end{array}}$

You can see that after each flip the outcome multiplies by two (because a flip can give 2 different results)

Now your problem can give 26 different results per letter, and only 3 letters matter. Therefore we get the answer of 26^3

you get the same answer with 6 places as well

7. Hello again, ashkash!

If we are considering all 26 letters of the alphabet,
. . we simply append a permutation factor.

With five letters, consider the first three letters.

3 different letters: .$\displaystyle ABC\;\;\Rightarrow\;\;ABCBA$ . . . one way

There are $\displaystyle 26$ choices for the "$\displaystyle A$",
. . $\displaystyle 25$ choices for the "$\displaystyle B$",
. . and $\displaystyle 24$ choices for the "$\displaystyle C$".

Hence, there are: .$\displaystyle 26\cdot25\cdot24 \times 1 \:=\:15,600$ ways.

2 different letters: .$\displaystyle \begin{array}{ccc}ABA\;\;\Rightarrow\;\;ABABA \\ AAB\;\;\Rightarrow\;\;AABAA \\ ABB\;\;\Rightarrow\;\;ABBBA\end{array}$ . . . three ways

There are $\displaystyle 26$ choices for the "$\displaystyle A$"
. . and $\displaystyle 25$ choices for the "$\displaystyle B$".

Hence, there are: .$\displaystyle 26\cdot25 \times 3 \:=\:1950$ways.

Only one letter: .$\displaystyle AAA\;\;\Rightarrow\;\;AAAAA$ . . . one way

There are $\displaystyle 26$ choices for the "$\displaystyle A$".

Hence, there are: .$\displaystyle 26 \times 1 \:=\:26$ ways.

Therefore, there are: .$\displaystyle 15,600 + 1950 + 26 \:=\:\boxed{17,576\text{ ways.}}$

8. just to clear confusion: $\displaystyle \underbrace{\overbrace{15600+1950+26}^{\text{Sorob }\!\!\text{an's Way}}=17576=\overbrace{26^3}^{\text{my way}}}_{\text{both ways give the same answer}}$