## 6. Pretty Numbers

A natural number is called pretty if its unit digit is equal to the product of all the remaining digits. How many four-digit pretty numbers are there?

## Result: $\quad 215$
Solution. Let the desired four-digit number be $\overline{a b c d}, a \neq 0$.

For $d=0$ we have $9 \cdot 19=171$ possibilities (for $a$ there are 9 possibilities, and for $b$ and $c$ there are a total of 19 possibilities with at least one digit being 0).

For $d=1$ we have one possibility, the number 1111.

For $d=2$ we have 3 possibilities, as the digits $a, b$ and $c$ are 1,1 and 2, in some order.

For $d=3$ we have 3 possibilities (the digits are 1,1,3).

For $d=4$ we have $3+3=6$ possibilities (the digits are 1,1,4 or 1,2,2).

For $d=5$ we have 3 possibilities (the digits are 1,1,5).

For $d=6$ we have $3+6=9$ possibilities (the digits are $1,1,6$ or 1,2,3).

For $d=7$ we have 3 possibilities (the digits are 1,1,7).

For $d=8$ we have $3+6+1=10$ possibilities (the digits are 1,1,8 or 1,2,4 or 2,2,2).

For $d=9$ we have $3+3=6$ possibilities (the digits are 1,1,9 or 1,3,3).

This is a total of $171+1+3+3+6+3+9+3+10+6=\mathbf{2 1 5}$ possibilities.