5. Tanya was sequentially writing down numbers of the form $n^{7}-1$ for natural numbers $n=2,3, \ldots$ and noticed that for $n=8$ the resulting number is divisible by 337. For what smallest $n>1$ will she get a number divisible by $2022?$
(T. A. Garmanova) Solution. Let the natural number $n$ be such that $n^{7}-1$ is divisible by $2022=2 \cdot 3 \cdot 337$. Then $n^{7}-1$ is divisible by 2 and 3, so $n$ is an odd number, having a remainder of 1 when divided by 3. In addition, $n^{7}-1$ is divisible by 337. Note that if two numbers are congruent modulo 337 (i.e., they give the same remainder when divided by 337), then their seventh powers are also congruent modulo 337. This means that to find the desired number, it is sufficient to consider all integers $n$ in the interval $[0 ; 336]$, satisfying the congruence $n^{7} \equiv 1(\bmod 337)$.

Now let's prove that any congruence of the form $P_{k}(n) \equiv 0(\bmod 337)$ has no more than $k$ solutions on the interval $[0 ; 336]$, where $P_{k}(n)$ is a polynomial of degree $k$ with integer coefficients. We will prove this by induction on $k$. For $k=1$, we get a congruence of the form $a n+b \equiv 0(\bmod 337)$, which has no more than one solution, since any integer $n \in(0 ; 336]$ is coprime with 337. Suppose the statement is true for all polynomials of degree $\leqslant k-1$. Consider the polynomial $P_{k}(n)$. If it has no roots, then the statement is satisfied. If it has a root, then the polynomial can be represented as $P_{k}(n)=(n-a) Q_{k-1}(n)$, and by the induction hypothesis, the polynomial $Q_{k-1}(n)$ has no more than $k-1$ roots. The statement is proved.

Now let's find all solutions to the congruence $n^{7} \equiv 1(\bmod 337)$ on the interval $[0 ; 336]$. We know two solutions: $n_{1}=1, n_{2}=8$. Note that if $n$ is a solution to the congruence $n^{7} \equiv 1(\bmod 337)$, then for any natural number $s$, the numbers $n^{s}$ are also solutions. Therefore, the solutions to this congruence are the numbers

$$
\begin{gathered}
8^{2}=64 \equiv 64 \quad(\bmod 337) \\
8^{3}=512 \equiv 175 \quad(\bmod 337) \\
8^{4} \equiv 8 \cdot 175 \equiv 52 \quad(\bmod 337) \\
8^{5} \equiv 8 \cdot 52 \equiv 79 \quad(\bmod 337) \\
8^{6} \equiv 8 \cdot 79 \equiv 295 \quad(\bmod 337)
\end{gathered}
$$

Thus, we have found seven solutions on the interval $[0 ; 336]: n_{1}=1, n_{2}=8, n_{3}=52, n_{4}=64, n_{5}=79$, $n_{6}=175, n_{7}=295$. According to the proof above, there are no other solutions on this interval. Among them, the odd numbers that have a remainder of 1 when divided by 3 are $n_{1}=1, n_{5}=79, n_{6}=175$ and $n_{7}=295$. The smallest one greater than 1 is $n_{5}=79$.

Answer: 79.