Problem

Source: Stars of Mathematics 2017, Seniors, Problem 1

Tags: algebra, number theory



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.