The Dictionary Quest
Unlocking the Rank of THAMS
Welcome, future engineer! Today, we are not just solving a permutation problem; we are embarking on a journey through the lexicographical order of the English language.
Imagine you are standing in a vast library, holding the word MATHS. Your task is to find the exact serial number of the word THAMS if all possible permutations of MATHS were arranged in a dictionary. This is a classic JEE Advanced challenge, and it requires a systematic, almost algorithmic mindset.
Phase 1
The Foundation of Order
Before we touch any math, we must establish the ground rules. A dictionary is strictly alphabetical.
Our first step is to sort the letters of MATHS in ascending order: A, H, M, S, T. This is our master key. Every word we form will follow this hierarchy.
Our target word is THAMS. We need to see how many words precede it.
Phase 2
The Great Bypass
We want to reach words starting with T. But in the dictionary, words starting with A, H, M, and S will appear long before we ever see a word starting with T. We need to count these blocks.
If we fix A in the first position, we have 4 remaining slots to fill with the letters H, M, S, T. The number of ways to arrange these is:
This means there are 24 words starting with A. The same logic applies to H, M, and S.
Since each of these letters precedes T, we must count all of them:
We have successfully bypassed 96 words that come before our target block.
Phase 3
The Descent into the T-Block
Now, we arrive at the words starting with T. Our target word THAMS starts with T, so we are finally in the right neighborhood!
We lock T in the first position. Now, we look at the second position. The available letters are A, H, M, S.
Alphabetically, A comes first. So, we consider words starting with TA. Since our target word is THAMS, any word starting with TA comes before THAMS.
We fix T and A. We have 3 slots remaining, which gives us:
Our running total is now 96+6=102.
Phase 4
The Final Match
We move to the next available letter for the second position, which is H. Our word starts with TH. This is a match!
We lock H in the second position. Now, we look at the third position. The remaining letters are A, M, S. Alphabetically, A comes first. We place A.
The word starts with THA. This is also a match! We lock A.
For the fourth position, we have M and S left. M comes before S. We place M. The word starts with THAM. This is a match!
Finally, we are left with only S for the last position. The word is THAMS. We have arrived at our destination.
The Conclusion
We have counted 96 words starting with A, H, M, S, plus 6 words starting with TA, and finally, we add 1 for the word THAMS itself.
The total rank is:
It is a beautiful, logical progression. Remember, in these problems, patience is your greatest tool. Don't rush the counting, and always respect the alphabetical order. You have mastered the dictionary logic!