How many distinct words of any (nonzero) length can be formed using the letters of KEPLER at most once each?
Clarification: Such a word can have two Es but can't have duplicates of any other letter.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Here is the brute force way:
length | no e's | 1 e | 2 e's |
1 | 4 | 1 | 0 |
2 | 1 2 | 2 ∗ 4 | 1 |
3 | 2 4 | 3 ∗ 1 2 | 3 ∗ 4 |
4 | 2 4 | 4 ∗ 2 4 | 6 ∗ 1 2 |
5 | 0 | 5 ∗ 2 4 | 1 0 ∗ 2 4 |
6 | 0 | 0 | 1 5 ∗ 2 4 |
For example, to get the number of 4 letter words with exactly 1 'e', we multiply the number of 3 letter words without 'e' (24) by 4 (the number of ways to insert an e, e.g., exxx, xexx, xxex, xxxe).
i divided it into two cases. 1) Considering only K,E,P,L,R the number of words obtained are: 5C1+5C2 *2! +5C2 *3! + 5C4 *4! +5!
2) making both the Es a permanent fixture the number of words obtained are: 1+ 4C1 *3!/2! + 4C2 *4!/2! + 4C3 *5!/2! +4C4 *6!/2! the answer comes out to be 1016. could you let me know where i am going wrong .
Your notation is right. Probably you made an error in calculations. Case 1 gives 325 and case 2 gives 685, so the sum is 1010.
The explanation for case 1 is that each term is the number of permutations of 5 different letters by 1, 2, 3, 4 and 5 respectively. So S 1 = ∑ 1 5 5 P i = 5 P 1 + 5 P 2 + 5 P 3 + 5 P 4 + 5 P 5 = 3 2 5 . This is the same as your formula, because 5 P i = ( 5 − i ) ! 5 ! = 5 C i ∗ i !
The explanation for case 2 is that each term is the number of combinations of 4 letters (excluding the 2 E's) by 0,1,2,3 and 4 respectively, multiplied by the number of permutations of 2,3,4,5 and 6 letters (including the 2 E's) of which 2 are same. The first factor is 4 C i and the second factor is 2 ! ( i + 2 ) ! . So S 2 = ∑ 0 4 ( 4 C i ) ∗ 2 ! ( i + 2 ) ! = 6 8 5 .
The final result is S 1 + S 2 = 3 2 5 + 6 8 5 = 1 0 1 0
Try considering both cases at once.. Its not likely to work your way
both cases cant be considered at once as there cant be 3 E's. I believe the cases are exhaustive.
@Souvik Paul – Your notation is hard to follow. You are right that the cases are mutually exclusive, there may be something wrong in the calculation. Explain how you are calculating each case.
Recheck your calculations, it seems correct.
Nice simple solution. Your example "easy" version has a problem, though :)
derp, really glad you pointed that out. Wish I'd used NEWTON for the original problem now, but whatever, Kepler wasn't half bad.
Incidentally, I haven't thought of any intuitive way to understand why the "add one then multiply by n" recurrence works. I listed the 15 words you can make out of ABC and tried to find a way to group them into 3 groups of 5 or 5 of 3, to no avail. Anyone?
Try writing out the pattern with nPr in long form:
So the point is that nPr = n * (n-1)P(r-1). So "multiply by n" turns the (1..n-1)-letter combinations from a length n-1 word into the (2..n)-letter combinations from a length n word, and then you have to add n new one letter words. And "multiply by n and then add n" is the same as "add 1 then multiply by n."
To solve this problem we have to find the number of distinct words for different lengths.
Formulas: n is the number of choices, r is how many we choose. Permutation: Order matters P ( n , r ) = ( n − r ) ! n ! Combination: Order doesn’t matter C ( n , r ) = r ! ( n − r ) ! n !
Length 6: First we find the number of combinations that we can have of the two E's in the word. Then we multiply the number of combinations by the number of permutations we can have for the remaining four letters. Another way to find this case is to take the number of permutations as if all 6 letters are unique, then divide by 2 since each word will be a duplicate. However, that way will not work when the length is less than 6.
C ( 6 , 2 ) = 1 5 P ( 4 , 4 ) = 2 4 ⇒ 1 5 ⋅ 2 4 = 3 6 0
Length 5: For this case and the rest, we further split them each into 2 mutually exclusive cases. One where the word contains 2 E's and the other when the word contains 1 E. For the first situation, we calculate it similarly as the case with length 6. For the second situation, we can go ahead and do a permutation since we don't have to worry about duplicates. Then we just add the number from each case.
C ( 5 , 2 ) = 1 0 P ( 4 , 3 ) = 2 4 ⇒ 1 0 ⋅ 2 4 = 2 4 0 P ( 5 , 5 ) = 1 2 0 ⇒ 2 4 0 + 1 2 0 = 3 6 0
Length 4:
C ( 4 , 2 ) = 6 P ( 4 , 2 ) = 1 2 ⇒ 6 ⋅ 1 2 = 7 2 P ( 5 , 4 ) = 1 2 0 ⇒ 7 2 + 1 2 0 = 1 9 2
Length 3:
C ( 3 , 2 ) = 3 P ( 4 , 1 ) = 4 ⇒ 3 ⋅ 4 = 1 2 P ( 5 , 3 ) = 6 0 ⇒ 1 2 + 6 0 = 7 2
Length 2: For this case, the first situation is a bit different since there is only 1 combination for 2 E's and we don't have any remaining letters to choose. But the calculation would still turn out the same if we chose to continue with the method from the previous cases.
C ( 2 , 2 ) = 1 P ( 4 , 0 ) = 1 ⇒ 1 ⋅ 1 = 1 P ( 5 , 2 ) = 2 0 ⇒ 1 + 2 0 = 2 1
Length 1: For this last case, it is obvious that we can 5 different words. But the formula for permutations would still work if we chose to use it.
P ( 5 , 1 ) = 5
Now we simply add up the total from each case and we will have the number of unique words with length 1- 6.
3 6 0 + 3 6 0 + 1 9 2 + 7 2 + 2 1 + 5 = 1 0 1 0
Problem Loading...
Note Loading...
Set Loading...
Let's solve this problem as if the name in question were EUCLID first, then figure out how to deal with the duplicate letter.
I know of no formula for this, so let's start small and see what pattern emerges:
If the source word had 1 letter ("A"), we could clearly make 1 word ("A").
If it had 2 letters ("AB"), we could make 4 ("A", "B", "AB", "BA").
For 3, we have: 3P1=3 of length 1, 3P2=6 of length 2 and 3P3=6 of length 3. 3 + 6 + 6 = 15.
For 4, 4P1 + 4P2 + 4P3 + 4P4 = 4 + 12 + 24 + 24 = 64.
So far, 1, 4, 15, 64. If we continue in this fashion we will see a pattern emerge: when adding the nth letter, we start from the previous number, add one, then multiply by n. For 5 we will have 325, and for 6 (as in EUCLID), 1956 (which I verified longhand, to be safe).
Now we must deal with that pesky duplicate E in KEPLER. How many have we overcounted? It turns out that every word containing any E in it has been counted exactly twice:
So everything was double-counted except the words containing no Es at all. Since those are all the possible words using the letters KPLR, there must be 64 of them as we worked out above (how convenient!). So 1956 - 64 = 1892 of them are our doubles, representing 946 unique overcounted words.
We can take either 946 + 64 or 1956 - 946 to get our answer, 1010.
(Verified with a simple computer program to generate and unique-ify the actual words.)