## Task 22/90

Determine all four-digit natural numbers $n$ in the decimal system with the following properties:

1. All digits $a_{i}$ and the cross sum $Q$ of $n$ are prime numbers.
2. It holds that $n=Q \cdot P+2$, where $P$ is the cross product of $n$.
## Solution by Kitaktus.

If all four digits of $n$ were odd or if two digits were 2 and the others were odd, then $Q$ would be even and at least 4, and hence not a prime number.

Since all digits of $n$ are prime numbers, only two cases are possible:

a) Exactly one digit is 2, and the others are odd prime numbers, i.e., 3, 5, or 7.

b) Exactly three digits are 2, and the other is an odd prime number, i.e., 3, 5, or 7.

In case b), $Q$ is at most $2+2+2+7=13$ and $P$ is at most $2 \cdot 2 \cdot 2 \cdot 7=56$. Therefore, $Q P+2$ is at most $13 \cdot 56+2=730$ and hence not a four-digit number.

Thus, only case a) remains.

Since one of the four digits is even, $P$ and hence $Q P+2$ are also even. Therefore, the last digit of $n$ is 2.

The first three digits are thus at least 3. Therefore, $3332 \leq n=Q P+2$, so $3330 \leq Q P$. Since $Q \leq 7+7+7+2=23$, it follows that $P \geq 145$. The product of the three odd digits must therefore be at least 73. If we order these three digits by size, the cases 333, 335, and 337 are ruled out. The remaining cases are 355, 357, 377, 555, 557, 577, and 777.

We now calculate $Q$, $P$, and $Q P+2$ for all these cases:

| Digits | $Q$ | $P$ | $Q P+2$ |
| :---: | :---: | :---: | :---: |
| 355 | 15 | 150 | 2252 |
| 357 | 17 | 210 | 3572 |
| 377 | 19 | 294 | 5588 |
| 555 | 17 | 250 | 4252 |
| 557 | 19 | 350 | 6652 |
| 577 | 21 | 490 | 10292 |
| 777 | 23 | 686 | 15778 |

Only for the digits 3, 5, 7 does $Q P+2=3572$ consist entirely of prime numbers. Clearly, 3572 satisfies all conditions of the problem and is therefore the only solution.