Consider the sequence of integers $ \left( a_n\right)_{n\ge 0} $ defined as $$ a_n=\left\{\begin{matrix}n^6-2017, & 7|n\\ \frac{1}{7}\left( n^6-2017\right) , & 7\not | n\end{matrix}\right. . $$Determine the largest length a string of consecutive terms from this sequence sharing a common divisor greater than $ 1 $ may have.
Problem
Source: Stars of Mathematics 2017, Seniors, Problem 1
Tags: algebra, number theory
sarjinius
06.02.2022 17:32
We claim that the largest possible length is $\boxed{2}$.
Note that $a_n \equiv 0 \pmod{3}$ for all $n \not\equiv 0 \pmod{3}$. Thus, the desired maximum length is at least $2$.
Now we will show it is less than $3$.
Let $b_n = n^6 - 2017$ for all positive integers $n$. So $b_n = a_n$ for all $n \equiv 0 \pmod{7}$ and $b_n = 7a_n$ for all $n \not\equiv 0 \pmod{7}$. Let $d \mid a_{n-1}, a_n, a_{n+1}$ for some $n \ge 1$, this must imply $d \mid b_{n-1}, b_n, b_{n+1}$.
If $d \mid b_{n-1}, b_n, b_{n+1}$, then since at least one of $b_{n-1}, b_n, b_{n+1}$ is odd, then $d$ is odd.
Then $d \mid b_{n-1}+b_{n+1}-2b_n = (n-1)^6+(n+1)^6-2n^6 = 30n^4+30n^2+2 = 2(15n^4+15n^2+1) \implies d \mid 15n^4+15n^2+1$. This also implies $gcd(d, n)=1$.
Also, $d \mid b_{n+1}-b_{n-1} = (n+1)^6-(n-1)^6 = 12n^5+40n^3+12n = 4n(3n^4+10n^2+3) \implies d \mid 3n^4+10n^2+3$.
Since $d \mid 15n^4+15n^2+1, 3n^4+10n^2+3$, we have
$d \mid 5(3n^4+10n^2+3)-(15n^4+15n^2+1) = 35n^2+14 = 7(5n^2+2)$.
If $n \equiv -1, 0, 1 \pmod{7}$, then one of $b_{n-1}, b_n, b_{n+1}$ is not divisible by $7$, so $7 \nmid gcd(a_{n-1}, a_n, a_{n+1})$.
If $n \equiv 2,3,4,5 \pmod{7}$, then $7 \mid b_{n-1}, b_n, b_{n+1}$ but $7 \nmid 5n^2+2 \implies 49 \nmid 7(5n^2+2) \implies 49 \nmid d$. Thus, $7 \nmid gcd(a_{n-1}, a_n, a_{n+1})$, and $7 \nmid d$.
If $7 \nmid d$, then $d \mid 5n^2+2$. So $d \mid (15n^2+9)(5n^2+2)-5(15n^4+15n^2+1)=13$. If $d=13$, then $13 \mid b_n \iff n^6 \equiv 2017 \equiv 2 \pmod{13}$. But since $n^6 \equiv -1,0,1 \pmod{13}$ for all integers $n$, contradiction. Hence $d$ can only be $1$.
Thus, the desired maximum length is $2$.