A cryptographic code is designed as follows. The first time a letter appears in a given message it is replaced by the letter that is place to its right in the alphabet (asumming that the letter is one place to the right of the letter ). The second time this same letter appears in the given message, it is replaced by the letter that is places to the right, the third time it is replaced by the letter that is places to the right, and so on. For example, with this code the word "banana" becomes "cbodqg". What letter will replace the last letter in the message
- A)
- B)
- C)
- D)
- E)
Answer
D
Key insight
The last s is the 12th s, so it moves 1 + 2 + ... + 12 = 78 places, exactly three trips around the alphabet.
Solution
Two jobs: find which appearance of the last one is, then work out how far it moves.
- Count the 's word by word:
| word | Lee's | sis | is | a | Mississippi | miss | Chriss |
|---|---|---|---|---|---|---|---|
| number of | 1 | 2 | 1 | 0 | 4 | 2 | 2 |
| running total | 1 | 3 | 4 | 4 | 8 | 10 | 12 |
The last is the th one.
2. The th appearance moves places. Pair the numbers from the outside in: , , and so on, six pairs of . So the shift is
3. The alphabet has letters, and moving places brings a letter back to itself. Since , the letter goes around three full times and stops where it started.
4. So the last becomes .
The answer is .
Why this works
With a wrap-around alphabet, only the leftover after taking out full trips of matters. Figure out the total shift first and remove the full trips, rather than stepping letter by letter. Most of the danger in this problem is simply counting the 's correctly, so a table is worth the few seconds.
The trap
Losing count of the s's (Mississippi has four, and Chriss has two), and then shifting by the wrong amount.
Concise solution
First count how many times the letter appears, word by word:
| word | Lee's | sis | is | a | Mississippi | miss | Chriss |
|---|---|---|---|---|---|---|---|
| number of | 1 | 2 | 1 | 0 | 4 | 2 | 2 |
Running total: . The final is the th occurrence.
The th occurrence of a letter moves places to the right. For this is .
Since the alphabet has letters, a shift of brings the letter all the way around three full times and back to where it started. The last is replaced by itself.
The answer is .
Review in the AoPS books
- Introduction to Number Theory, Chapter 12: Introduction to Modular Arithmetic
- Introduction to Algebra, Chapter 21: Sequences & Series (§21.1, §21.2, §21.3, §21.4)
- Introduction to Number Theory, Chapter 10: Units Digits
- Intermediate Algebra, Chapter 17: More Sequences and Series (§17.1, §17.2)
Techniques
Set up the equation/formula and compute; no special trick needed