$x^4 + 1020x^3 - 4x^2 + 2039x+1$ is divisible by 1019. Give all integers x in the range [1,2018] such that $x^4 + 1020x^3 - 4x^2 + 2039x+1$
is divisible by 1019.
Applying mod 1019 to the coefficients, we have
$x^4 + x^3 - 4x^2 + x + 1$ which is equal to $(x-1)^2(x^2+3x+1)$
I tried making 1 of the factors equal to a multiple of 1019, but it looks tedious and i have not found a solution other than 1020.
answer given : 1, 492, 524, 1010, 1511, 1543

As $1019$ is prime, one of the factors must be $\equiv 0\pmod{1019}$. For $(x-1)$ this obviously means that $x=1$ or $x=1020$.
For the factor $x^2+3x+1$, we'd expect two solutions $x=\frac{-3\pm\sqrt{5}}2$ - but what is $\sqrt 5$ in modular arithmetic? Any $y$ with $y^2\equiv 5\pmod{1019}$. Fortunately, just playing with $1019+5=1024$, we see that $32^2\equiv5\pmod{1019}$. Hence $\frac{-3+32}{2}\equiv\frac{1016+32}{2}=524$ and $\frac{-3-32}{2}\equiv\frac{1016-32}{2}=492$ are remainders mod $1019$ that solve too (i.e., $492$, $524$, $1511$,$1543$)
