Counting permutations of a string with repeating characters

Click For Summary
The discussion focuses on calculating the number of five-letter strings of capital letters that contain at least one letter repeated twice in a row. The initial approach involved selecting letters and positions, leading to a total of 1,622,400 valid combinations. However, participants suggested an alternative method by first calculating the total number of strings without adjacent repeats, which is 26 multiplied by 25 raised to the power of 4. This approach helps clarify the solution by allowing the exclusion of non-compliant strings from the total. Ultimately, the correct calculation confirms the method's validity and provides a clearer understanding of the problem.
squelch
Gold Member
Messages
56
Reaction score
1
The problem statement:

How many five-letter strings of capital letters have a letter repeated twice in a row? For example, include ABCCA and AAABC and ABBCC but not ABCAD.

The attempt at a solution:

  • First, let's break down how we would perform the selection of a string that meets the question's criteria.
    • We select the first letter. There are 26 choices. This selection also triggers selection of the second letter, for which there is only one choice.
    • We then decide where in the five-position string to place these letters. There are four possible positions.
    • We then select for the other three letters. There are 26 possibilities for each letter, but we should exclude repeats. So the number of permutations for 26 letters to appear in three positions is P(26,3)=##\frac{26!}{(26-3)!}##
  • Then we combine the choices using the Product Rule.
    • [choices for first letter] * [choices for second letter] * [choices for position of first and second letter] * [permutations for remaining letters]
    • ##26*1*4*\frac{26!}{(26-3)!}=1622400##
  • We can then conclude that there are 1 622 400 such choices.
I have been having a bit of trouble with this topic, so I'm essentially looking for a sanity check on this solution. I get the sense that I may have missed some key point.
 
Physics news on Phys.org
squelch said:
The problem statement:

How many five-letter strings of capital letters have a letter repeated twice in a row? For example, include ABCCA and AAABC and ABBCC but not ABCAD.

The attempt at a solution:

  • First, let's break down how we would perform the selection of a string that meets the question's criteria.
    • We select the first letter. There are 26 choices. This selection also triggers selection of the second letter, for which there is only one choice.
    • We then decide where in the five-position string to place these letters. There are four possible positions.
    • We then select for the other three letters. There are 26 possibilities for each letter, but we should exclude repeats. So the number of permutations for 26 letters to appear in three positions is P(26,3)=##\frac{26!}{(26-3)!}##
  • Then we combine the choices using the Product Rule.
    • [choices for first letter] * [choices for second letter] * [choices for position of first and second letter] * [permutations for remaining letters]
    • ##26*1*4*\frac{26!}{(26-3)!}=1622400##
  • We can then conclude that there are 1 622 400 such choices.
I have been having a bit of trouble with this topic, so I'm essentially looking for a sanity check on this solution. I get the sense that I may have missed some key point.
Not sure I follow you reasoning, especially the part about "We then select for the other three letters ..."

Hint: compute the number of 5 letter words that don't meet the question's criteria, meaning that no two adjacent letters are the same.
 
Last edited:
  • Like
Likes squelch
Samy_A said:
Not sure I follow you reasoning, especially the part about "We then select for the other three letters."

Hint: compute the number of 5 letter words that don't meet the question's criteria, meaning that no two adjacent letters are equal.

Okay, so I know that the total number of strings is 265.

I consider a string where I'm selecting each character in turn to try to decide how many choices I get at each stage. If I want to construct a string where no two adjacent characters are the same, it seems that I could construct it in this way:
[ 26 choices for character 1] * [25 choices for character 2] * [25 choices for character 3] * [25 choices for character 4] * [25 choices for character 5]
... so 26*254 choices to exclude? That doesn't seem intuitive.

ninja edited to correct a horrible error
 
squelch said:
Okay, so I know that the total number of strings is 265.

I consider a string where I'm selecting each character in turn to try to decide how many choices I get at each stage. If I want to construct a string where no two adjacent characters are the same, it seems that I could construct it in this way:
[ 26 choices for character 1] * [25 choices for character 2] * [26 choices for character 3] * [25 choices for character 4] * [26 choices for character 5]
... so 263*252 choices to exclude? That doesn't seem intuitive.
Do you really have 26 choices for character 3 (and character 5)?
 
That was an awful error of mine that I thought I had corrected via edit fast enough, but alas, I did not.

Corrected:
[ 26 choices for character 1] * [25 choices for character 2] * [25 choices for character 3] * [25 choices for character 4] * [25 choices for character 5]
... so 26*25^4 choices to exclude?
 
squelch said:
That was an awful error of mine that I thought I had corrected via edit fast enough, but alas, I did not.

Corrected:
[ 26 choices for character 1] * [25 choices for character 2] * [25 choices for character 3] * [25 choices for character 4] * [25 choices for character 5]
... so 26*25^4 choices to exclude?
Yes, that is the result I also have : 265-26*254.
 
  • Like
Likes squelch
That was exceedingly helpful, thank you.
 

Similar threads

  • · Replies 36 ·
2
Replies
36
Views
8K
  • · Replies 52 ·
2
Replies
52
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
Replies
2
Views
7K