Counting permutations of a string with repeating characters

Click For Summary
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 solution involves selecting the first letter (26 choices), the second letter (1 choice), and determining the positions for these letters (4 choices). The remaining three letters are selected from 26 letters with the formula P(26,3) = 26!/(26-3)!. The final calculation yields a total of 1,622,400 valid strings using the Product Rule.

PREREQUISITES
  • Understanding of permutations and combinations
  • Familiarity with the Product Rule in combinatorics
  • Basic knowledge of factorial notation
  • Concept of adjacent character restrictions in string formation
NEXT STEPS
  • Study the concept of permutations with restrictions in combinatorial mathematics
  • Learn about the inclusion-exclusion principle for counting problems
  • Explore advanced combinatorial techniques for string formation
  • Investigate applications of combinatorial counting in computer science
USEFUL FOR

Mathematicians, computer scientists, and anyone interested in combinatorial problems and string theory will benefit from this discussion.

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   Reactions: 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   Reactions: 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 6 ·
Replies
6
Views
985
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K