
1. Nice prime is a prime equal to the difference of two cubes of positive integers. Find last digits of all nice primes.

(Patrik Bak, Michal Rolínek)


Solution. Firstly, let us note that $5^{3}-4^{3}=61,2^{3}-1^{3}=7$ and $3^{3}-2^{3}=19$ are nice primes, so 1, 7 and 9 belong to desired digits. We show that they are all desired digits.

Let $p=m^{3}-n^{3}$ be a nice prime, where $m>n$ are positive integers. Second factor in rewriting

$$
p=m^{3}-n^{3}=(m-n)\left(m^{2}+m n+n^{2}\right),
$$

is greater than 1 , thus the first one is 1 and therefore $m=n+1$. After substitution we obtain

$$
p=3 n^{2}+3 n+1 \text {. }
$$

An estimate $3 n^{2}+3 n+1>6$ gives that the prime $p$ is odd and greater that 5 . This excludes $0,2,4,5,6$ a 8 as the last digits and 3 stays the only remaining digit to exclude.

It is sufficient to find remainders of the numbers $3 n^{2}+3 n+1$ after division by 5. For remainders $0,1,2,3$ and 4 of $n$ we obtain remainders $1,2,4,2,1$ of (1) which ones really exclude the last digit 3 .

Answer. The last digits of the nice primes are 1,7 and 9 .
