13.7k views
0 votes
You are the assistant to Tyrion Lannister, the postmaster general for the land of Westeros. Tyrion has designed a new postal code system of the form "xXN-TTTT-yyyx" which satisfies the following rules • xx must be a two digit number. The first digit must be odd. The second digit must be a different number which is not adjacent to the first. For example, if the first digit is a 3 then the second digit cannot be a 2.3. or 4. Note that is not adjacent to 9. . N must be a consonant which occurs after M in the English alphabet. Only capital letters are rulowed. • TTTT can be any four-letter permutation of the letters "TYRION." The letters can be either lowercise or upper case, but are not allowed to repeat. The same letter with a different capitalization is considered distinct. So for example, "Yyrt" is valid yyy is a three digit number, however, no consecutive sequence of at least two l's is permitted. For example, 911 (two consecutive 1's) and 111 (three consecutive 1's) are invalid, but 181 is valid • is the remainder of yyy when divided by 3. For example, if yyy is 182, then the remainder of 182 when divided by 3 is 2, so z is 2 You have tried to convince Tyrion that this system is insane, but he won't listen to you. Instead, he's demanded that you determine if there are enough possible postal codes to uniquely assign each home in Westeros a unique postal code. There are 15 million people living in Westeron. Is it possible to give each home a unique postal code?

User Laindir
by
8.8k points

1 Answer

7 votes

Okay, let's break this down step-by-step:

1) xx must be a two digit number where the first digit is odd and not adjacent to the second digit. There are 5 possible first digits (1, 3, 5, 7, 9) and for each of those, there are 3 possible non-adjacent second digits. So there are 5 * 3 = 15 possible combinations for xx.

2) N must be a consonant after M, so there are 5 options (N, P, R, S, T).

3) TTTT can be any permutation of TYRION, with repetitions allowed as long as the letters are different cases. There are 4 letters with 2 case options each, so there are 16 possible permutations.

4) yyy is a 3 digit number with no consecutive identical digits. There are 9 options for the first digit. For the second digit, there are 8 options if the first digit is not 1 or 9, or 7 options if the first digit is 1 or 9. For the third digit, there are 8 or 7 options depending on the first two digits. So there are 9 * 8 * 8 + 9 * 7 * 8 = 648 possible combinations for yyy.

5) z is the remainder of yyy divided by 3, so it can be 0, 1 or 2.

Total possible postal codes = 15 * 5 * 16 * 648 * 3 = 1,436,800

Since there are 15 million homes in Westeros, it is not possible to assign each home a unique postal code with Tyrion's system. There are simply not enough possible postal codes.

In summary, no it is not possible to uniquely assign a postal code to each of the 15 million homes in Westeros using Tyrion's insane system. Please let him know that a different system is needed!

User Piotr Niewinski
by
7.8k points