Pedrinho makes a list of all the 5-digit numbers with distinct digits that can be formed with the digits $1,2,3,4,5$. In this list, the numbers are arranged in ascending order.

a) What is the number that occupies the 10th position in the list?

b) What is the number that occupies the 85th position in the list?
Solution

a) We start by writing the first numbers in the list:

12345, 12354, 12435, 12453, 12534, 12543, 13245, 13254, 13425, 13452.

Thus, the tenth number is 13452.

b) To find the number that occupies position 85, we notice that whenever a 5-digit number starts with the digit 1, this number is smaller than a 5-digit number that starts with the number 2. In turn, this number is smaller than one that starts with 3, and so on. So, we will count how many of these numbers start with 1, 2, etc.

If we fix the first digit, for example, 1, we will have 4 choices for the second digit, namely, each of the numbers $2, 3, 4$, and 5. For the third digit, we will have only 3 choices, as we cannot choose a digit that has already been used, and so on. We will have 2 choices for the fourth digit and only one choice for the last digit. Therefore, we have $4 \times 3 \times 2 \times 1 = 24$ 5-digit numbers that start with 1 in Pedrinho's list, and clearly, these have to be the first 24 numbers, as they start with 1.

Similarly, we also have 24 numbers that start with 2 (it's exactly the same calculation, replacing 1 with 2), which have to be the next 24 numbers in the list. The same applies to 3, 4, and 5. We conclude then that the first 24 numbers start with 1, then we have 24 that start with 2, followed by 24 that start with 3. Therefore, the number in position 73 is the first number that starts with 4, which is the number 41235, while the number in position 96 is the last number that starts with 4, i.e., the number 45321.

We conclude then that the number in position 85 is a number that starts with 4. What we will do now is repeat the process above for the second digit. Using the same argument as above, we have $3 \times 2 \times 1 = 6$ numbers that start with 41, and these are clearly smaller than those that start with 42 (which are also 6). Since $72 + 6 + 6 = 84$, the number that occupies position 85 is the first number that starts with 43, i.e., the number 43125.