5. Let $n>2$ be a natural number, $1=a_{1}<\ldots<a_{k}=n-1$ be all numbers from 1 to $n$ that are coprime with $n$. Denote by $f(n)$ the greatest common divisor of the numbers $a_{1}^{3}-1, \ldots, a_{k}^{3}-1$. What values can the function $f(n)$ take?
Answer: 1, 2, 7, 26, 124 (achieved for $n=5,10,3,4,6$ respectively). Cases $n \leqslant 7$ are considered directly, and from now on we assume that $n>7$. We call numbers of the form $a_{i}^{3}-1$ special.

Let $n>7$ be odd. Then among the special numbers there are both $2^{3}-1=7$ and either $7^{3}-1$ (if $n$ is not divisible by 7) or $(n-2)^{3}-1$ (if $n$ is divisible by 7). In both cases, we find two coprime special numbers, so $f(n)=1$.

Now let $n=2^{k} b$, where $b$ is odd and $k \geqslant 1$. Then all special numbers are even. If $b=1$, then $k \geqslant 3$, and among the special numbers there are $3^{3}-1=26$ and $5^{3}-1=124$, hence $f(n)=2$. If $b=3$, then $k \geqslant 2$, and among the special numbers there are $5^{3}-1=124=4 \cdot 31$ and $7^{3}-1=342=2 \cdot 9 \cdot 19$. Again, we get $f(n)=2$. Finally, let $b \geqslant 5$. Then among the special numbers there are $(b-4)^{3}-1,(b-2)^{3}-1,(b+2)^{3}-1,(b+4)^{3}-1$. Therefore, $f(n)$ divides $(b+4)^{3}+(b-4)^{3}-(b+2)^{3}-(b-2)^{3}=72 b$. At least one of the numbers $(b-2)^{3}-1$ and $(b-4)^{3}-1$ is not divisible by 3, and at least one of them is not divisible by 4. Thus, if $f(n) \neq 2$, then $f(n)$ must have a common prime divisor $p$ with the number $b$. Since $(b-2)^{3}-1$ is divisible by $p$, we get $p=7$ and $b$ is divisible by 7. But then the special number $(n-1)^{3}-1$ is not divisible by $7-$ a contradiction.