What digit can the positive integer $n \geq 3$ end with, if $n+n^{2}+\ldots+n^{2 n-3}-4$ is a prime number?
Solution. Let $S=n+n^{2}+\ldots+n^{2 n-3}-4$. If $n=3$, then $2 \cdot 3-3=3$ and $3+3^{2}+3^{3}-4=35$, which is not a prime. Therefore, the value of $S$ is at least 35.

If $n$ is even, then $S$ will be an even number greater than 35, which cannot be a prime. Therefore, $n$ must be odd. The remainder of $n$ when divided by 10 can be considered in five cases.
i) $n=10 k+1$ (where $k$ is at least 1). Then $2 n-3=20 k-1$, and

$$
S=(10 k+1)+(10 k+1)^{2}+\ldots+(10 k+1)^{20 k-1}-4
$$

Consider the last digit of the terms, their sum is:

$$
\underbrace{1+1+\ldots+1}_{20 k-1 \text { terms }}-4=20 k-5
$$

Thus, the last digit is 5, meaning $S$ is divisible by 5.

ii) $n=10 k+3(k \in \mathbb{N})$. Then $2 n-3=20 k+3$ and

$$
S=(10 k+3)+(10 k+3)^{2}+\ldots+(10 k+3)^{20 k+3}-4
$$

Again, consider the last digits:

$$
\underbrace{3+9+7+1}_{20}+\underbrace{3+9+7+1}_{20}+\ldots+\underbrace{3+9+7}_{19}-4
$$

The last digit is also 5, so $S$ is not a prime.

iii) $n=10 k+5(k \in \mathbb{N})$. Then $2 n-3=20 k+7$. By examining the last digit similarly, we get 1, which could be a prime. For example, if $n=5$, then $S=5+5^{2}+5^{3}+\ldots+5^{7}-4=97651$, which is a prime.

iv) $n=10 k+7(k \in \mathbb{N})$. Then $n=20 k+11$, and

$$
S=(10 k+7)+(10 k+7)^{2}+\ldots+(10 k+7)^{20 k+11}-4
$$

The last digits are:

$$
\underbrace{7+9+3+1}_{20}+\underbrace{7+9+3+1}_{20}+\ldots+\underbrace{7+9+3}_{19}-4
$$

Here, the last digit is also 5, so $S$ cannot be a prime.
v) $n=10 k+9(k \in \mathbb{N})$. Then $2 n-3=20 k+15$, and

$$
S=(10 k+9)+(10 k+9)^{2}+\ldots+(10 k+9)^{20 k+15}-4
$$

The last digits are:

$$
\underbrace{9+1}_{10}+\underbrace{9+1}_{10}+\ldots+\underbrace{9+1}_{10}+9-4
$$

Here, the last digit is also 5.

Therefore, the last digit of $n$ can only be 5.

Remarks. 1. Some did not examine the last digit, or the remainder modulo 10, but the remainder modulo 5. They also reached the goal in a similar way.

2. The fact that the expression $S$ is divisible by 5 for all odd values of $n$ that are not divisible by 5 is not entirely coincidental. Write $n$ in the form $n=2 k+1$. If $n$ gives a remainder of 1 when divided by 5, then this is true for all its powers, and in this case, $2 k$, and therefore $k$ is also divisible by 5. Thus, the value of $n+n^{2}+\ldots+n^{2 n-3}$, as the sum of $2 n-3=4 k-1$ numbers that give a remainder of 1, gives a remainder of -1, and subtracting 4 results in a number divisible by 5. Otherwise,

$$
S=n\left(1+n+\ldots+n^{2 n-4}\right)-4=n \frac{n^{2 n-3}-1}{n-1}-4=\frac{n^{4 k}-1}{n-1}-5
$$

and here $n^{4 k}-1$ is divisible by 5 by Fermat's "little" theorem, and the denominator of the fraction is not.