0
$\begingroup$

Question: Given the alphabet $\{a, b, c\}$, how many words can we form with 4 letters? And how many words can we form with up to 4 letters?

I was thinking about the logic behind this and came up with this: perhaps the number of words that can be formed with 4 letters is $4^3 = 64$ words. Is that correct?

I could not think about how many words up to 4 letters, because that includes words with 1, 2 and 3 letters.

$\endgroup$
  • 3
    $\begingroup$ Hint: by the same token, the words having only 1 letter are $1^3 = 1$. Does it look right? For "up to four", count the words having 0,1,2,3,4 letters using the same "corrected" formula. $\endgroup$ – chi May 1 '17 at 19:32
3
$\begingroup$

Assume you have the alphabet $\{A,B,C\}$ and you want to form words of length 4.

For the first letter you have 3 choices, $A, B$ or $C$. For the second letter you have again 3 choices, $A,B$ or $C$ and so on. In total: $ 3 \cdot 3 \cdot 3 \cdot 3 = 3 ^ 4 = 81 $ possibilities.

$\endgroup$
2
$\begingroup$

Does not "with up to 4 letters" mean that we should count 1-letter, 2-letter, 3-letter, and 4-letter words? Then the answer is $3 + 3^2 + 3^3 + 3^4$.

$\endgroup$
  • 1
    $\begingroup$ You forgot the empty word. This is computer science after all :) $\endgroup$ – 6005 Jun 1 '17 at 0:08
  • $\begingroup$ @6005. Sorry, you are right. :-D $\endgroup$ – fade2black Jun 1 '17 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.