2. The sum of all four-digit natural numbers divisible by 45, where the tens digit is three times the hundreds digit, minus the sum of all three-digit natural numbers divisible by 18, where the hundreds digit is the largest one-digit prime number.
2. The sum of all four-digit natural numbers divisible by 45, where the tens digit is three times the hundreds digit, decreased by the sum of all three-digit natural numbers divisible by 18, where the hundreds digit is the largest one-digit prime number.

## Solution.

A number is divisible by 45 if it is divisible by 9 and 5. A number is divisible by 9 if the sum of its digits is divisible by 9, and by 5 if its last digit is 0 or 5.

Since the tens digit is three times the hundreds digit, the possible combinations of these two digits are:

hundreds digit 0, tens digit 0

hundreds digit 1, tens digit 3

hundreds digit 2, tens digit 6

hundreds digit 3, tens digit 9

$1 \text{ POINT}$

The units digit of the desired four-digit numbers can be 0 or 5.

If the units digit is 0, then (due to the rule of divisibility by 9) we have the following solutions: $9000, 5130, 1260$, and 6390.

If the units digit is 5, then (due to the rule of divisibility by 9) we have the following solutions: 4005, 9135, 5265, and 1395.

The sum of all four-digit numbers that satisfy the desired property is:

$9000 + 5130 + 1260 + 6390 + 4005 + 9135 + 5265 + 1395 = 41580$.

A number is divisible by 18 if it is divisible by 9 and 2. A number is divisible by 9 if the sum of its digits is divisible by 9, and by 2 if its last digit is 0, 2, 4, 6, or 8.

Since the hundreds digit is the largest one-digit prime number, the hundreds digit is 7.

The sum of all three-digit numbers that satisfy the desired property is:

$720 + 702 + 792 + 774 + 756 + 738 = 4482$.

Note. If the student, when determining the four-digit numbers, failed to notice that the tens and hundreds digits can both be zero, i.e., omitted the numbers 9000 and 4005, the sum is 28575, the difference is 24093, and the task should be graded with a maximum of 7 POINTS.