Number Theory: Find possible $n$ values that $n(n+1)(5n+2)$ is divisible by $2017^{2018}$ Assume $m= 2017^{2018}.$ How can I find possible value(s) of $n$ that $n < m$ and $n(n+1)(5n+2)$ is divisible by $m$.
Any hints?

$2017$ is prime.  $\gcd(n,n+1) = 1$, $\gcd(5n+2,n) = \gcd(2,n) = \{1,2\}$, $\gcd(5n+2, n+1) = \gcd(-3, n+1) = \{3,1\}$.  So if $2017^{2018}|n(n+1)(5n+2)$ then either
$2017^{2018}|n$ and $n = k*m$.
or $2017^{2018}|n+1$ and $n= k*m - 1$.
or $2017^{2018}|5n + 2$ and $n = \frac{km- 2}5$.  This requires $km \equiv 2 \mod 5$  As $2017 \equiv 2 \mod 5$ and $2^4 \equiv 1 \mod 5$, $2017^{2018} \equiv 2^2 \equiv 4 \mod 5$ so we need $4k \equiv 2 \mod 5$ so $k \equiv 3 \mod 5$.  $n = \frac{(5j+3)m - 2}5$
..... But (dopeslap!)  $n < m$ (didn't see that at first)
So $n = m -1$ or  $n = \frac {3m - 2}5$
Oh, or $n = 0$... or $n - 1$ or any of the negative multiples above.  I assume that $n$ is natural number....
