4. For which natural numbers $n$ is the sum of the digits of the number $n!$ equal to 9?
Solution. Let $x_{n}$ be the sum of the digits of the number $n$!. The number $n$! is divisible by 9 if and only if $n \geq 6$. Furthermore, we have

$$
\begin{aligned}
& 6!=720, \quad x_{6}=9, \quad 7!=5040, \quad x_{7}=9 \\
& 8!=40320, \quad x_{8}=9, \quad 9!=362880, \quad x_{9}=x_{10}>9
\end{aligned}
$$

Let $n \geq 11, n!=\overline{a_{k} a_{k-1} \ldots a_{2} a_{1} a_{0}}$. Suppose that

$$
a_{0}+a_{1}+a_{2}+\ldots+a_{k-1}+a_{k}=9
$$

Since $n \geq 11$, the number $n$! is divisible by 11, so

$$
a_{0}-a_{1}+a_{2}-\ldots+(-1)^{k-1} a_{k-1}+(-1)^{k} a_{k}=11 m
$$

where $m$ is an integer. Since

$$
-9=-\left(a_{0}+a_{1}+\ldots+a_{k}\right) \leq a_{0}-a_{1}+a_{2}-\ldots+(-1)^{k} a_{k}=11 m \leq a_{0}+a_{1}+\ldots+a_{k}=9
$$

we get $m=0$. If we add equations (1) and (2), we get

$$
2\left(a_{0}+a_{2}+a_{4}+\ldots\right)=9
$$

which is a contradiction. Therefore, the required numbers are 6, 7, and 8.

## II year