1
$\begingroup$

This is a question that I came across and I'm not able to understand how I should approach this.

Question: "You can use all the alphabets in English only for this (i.e., 26), repetition of alphabets are allowed, all the characters should be in lowercase. If you have to construct a string with length of minimum 3 characters to maximum 8 characters, how many total possibilities of strings would you have?"

I think this has some link with combination and permutation but I don't think I'm doing it right because when I wrote a simple code to check the how many such strings could be made with only 3 characters I get answer as 17576 but I don't get the same answer with either combination or permutation, may be I'm missing something here.

Image of the result of the Combination and Permutation for 3 characters

What would be the correct formula for calculating this? and how should I approach this for the series [3, 4, 5, 6, 7, 8]

$\endgroup$
1
  • $\begingroup$ Hint: repetition of alphabets are allowed, $\endgroup$
    – Daron
    May 25, 2022 at 12:59

1 Answer 1

0
$\begingroup$

Repetitions are allowed.

The number $_{26} C _3$ is the number of ways of choosing 3 distinct letters. The number of things like $\{a,b,c\}, \{c,x,z\}$ but not something like $\{a,a,b\}$.

There is no mention of putting the letters in an order so this is not the way to do it.

The number $_{26} P _3$ is the number of ways of choosing 3 distinct letters and putting them in an order. Things like "$abc$" or "$how$". But not something like "$too$" since the letters are not distinct..

We can write $_{26} P _3 = 26*25*24$. i.e choose the first letter from the 26 choices. Then choose the second from the 25 remaining choices. Then choose the third from the 24 remaining choices.

In your case the letters need not be distinct. You are allowed have strings "$aaa$" and "$boo$" for example. This makes the formula simpler than the above.

$\endgroup$
4
  • $\begingroup$ So, you're telling OP how not to do the problem, but not telling OP how to do the problem. $\endgroup$ May 25, 2022 at 13:11
  • 1
    $\begingroup$ @GerryMyerson Yes. $\endgroup$
    – Daron
    May 25, 2022 at 13:12
  • $\begingroup$ Thank you for your explanation, I think I found my answer it is just square and addition. (26^3)+(26^4)+(26^5)+(26^6)+(26^7)+(26^8) = 217,180,146,4568, isn't it? $\endgroup$
    – Hathick
    May 25, 2022 at 14:12
  • $\begingroup$ @Hathick That is correct. $\endgroup$
    – Daron
    May 25, 2022 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .