Problem 2. The number 509 has a sum of digits of 14, since $5+0+9=14$. Determine the largest three-digit number whose sum of digits is 12 and find the smallest three-digit number whose sum of digits is 21? Determine the difference between these two numbers.
Solution. For the three-digit number to be the largest, the digit in the hundreds place must be the largest, which means it should be 9. Then, the sum of the remaining two digits must be 3. Since $3=3+0=2+1=1+2=0+3$, it follows that the largest number formed from these digits is 930.

For the desired three-digit number to be the smallest, the digit in the hundreds place must be 1, but then the sum of the remaining two digits would be 20, which is not possible, as the maximum sum can only be 18 if both digits are nines. The same applies if the digit in the hundreds place is 2, it is not possible. Therefore, the digit in the hundreds place is 3. Now the sum of the other two digits must be 18, which means the desired number is 399.

The difference between these numbers is $930-399=531$.