## Task B-1.3.

How many five-digit multiples of 15 have digits from the set $\{0,1,2\}$?
## First solution.

The first digit must be different from 0. A number is divisible by 15 if it is divisible by 3 and 5.

A number is divisible by 5 if its last digit is 0 or 5, and since the digits can only be $0,1,2$, the last digit can only be 0.

The first digit can be 1 or 2. Therefore, the desired multiples are of the form $\overline{1 x y z 0}$ or $\overline{2 x y z 0}$.

For a number to be divisible by 15, it must also be divisible by 3, so the sum of its digits must be divisible by 3. The following possibilities exist:

$1+x+y+z=3$,

$1+x+y+z=6$,

$2+x+y+z=3$,

$2+x+y+z=6$,

that is, the sum of the digits $x, y$, $z$ can be $1,2,4$ and 5.

Since the digits $x, y, z$ are from the set $\{0,1,2\}$, the given sums can be obtained in the following ways:

The sum 1 can be obtained if two digits are 0 and one digit is 1. There are 3 possibilities for this because the digit 1 can be placed in three ways, that is, it can be any of the digits $x, y$ or $z$.

The sum 2 can be obtained if two digits are 0 and one digit is 2, or if two digits are 1 and one digit is 0. As in the previous case for the sum 1, we conclude that there are $3+3=6$ possibilities.

The sum 4 can be obtained if two digits are 1 and one digit is 2, or if two digits are 2 and one digit is 0. As in the previous case, there are $3+3=6$ possibilities.

The sum 5 can be obtained if two digits are 2 and one digit is 1. As in the first case, there are 3 possibilities.

Thus, there are $3+6+6+3=18$ desired multiples.