Find all intergers such that $2n^2+1$ divides $n^3+9n-17$ Find all intergers such that $2n^2+1$ divides $n^3+9n-17$.
Answer : $n=(2 \ and \  5)$
I did it.
As $2n^2+1$ divides $n^3+9n-17$, then $2n^2+1 \leq n^3+9n-17 \implies n \geq 2$
So $n =2$ is solution and doens't exist solution when n<2. How can I do now to find 5 ? Or better, how can you solve this with another good method ?
Thanks
 A: HINT:
If integer $d$ divides $n^3+9n-17,2n^2+1$
$d$ must divide  $2(n^3+9n-17)-n(2n^2+1)=17n-34$
$d$ must divide  $17(2n^2+1)-2n(17n-34)=68n+17$
$d$ must divide  $68n+17-4(17n-34)=153$
So the necessary condition is  $2n^2+1$ must divide $153$
$\implies2n^2+1\le153\iff n^2\le76\iff-9<n<9$
A: The elimination in Lab's answer essentially employs the extended Euclidean algorithm to compute a Bezout identity. As usual, when we need only the result, such calculations can be simplified using modular arithmetic (so simple they can often be done mentally with practice). For example
$$\begin{eqnarray} 
2n^2+1\ &\,\mid &\, n^3+9n-17\\[.2em]
\Rightarrow\ {\rm mod}\,\ \color{#0c0}{2n^2}\!+\color{#c00}1\!:\ \ 0 &\equiv&\, 2\,(n^3+\ 9n\,-\,17)\\[.2em]
&\equiv&\, \color{#0a0}{2n^2}n + 18n -34\\[.2em]
&\equiv&\, 17(n\!-\!2)\ \ \ {\rm by}\ \ \ \color{#0a0}{2n^2}\equiv -\color{#c00}1\\[.2em]
2(\color{#90f}{n\!+\!2})\times{\rm prior}\,\Rightarrow\ \  0 &\equiv&\, 34(n\!-\!2)(\color{#90f}{n\!+\!2})\\[.1em] 
&\equiv&\, 17\cdot\color{#0a0}{2n^2}-34\cdot 4\equiv -153 
\end{eqnarray}\qquad\qquad$$
Remark $\ $ The multiplication by the factor $\,2(\color{#90f}{n\!+\!2})\,$ in the 2nd last step is not ad-hoc. Rather, it corresponds to taking the "norm" of a quadratic number, since here we have that $\, \color{#0a0}{n^2} \equiv -1/2\,$ so, ring-theoretically, $\,n\,$ behaves like $\,\sqrt{-1/2} = \sqrt{-2}/2,\,$ so we can do things like taking "norms" of expressions involving the "surd" $\,n,\,$ in order to get a simpler multiple, by mapping "irrational" obects into "rational" objects - as I did above, viz. $\,0\equiv \alpha\,\Rightarrow\, 0\equiv 2 N(\alpha) = 2\alpha\alpha'\equiv -153.$
We can also do the above computation using a slight generalization of the Euclidean algorithm that allows us to scale by integers coprime to the gcd.
The reason why this works will become clearer when one learns about various universal viewpoints of ring-theoretic objects. To me this is one of the most beautiful aspects of algebra - dramatically illustrating the success and power of the abstraction of algebraic structures such as rings.
A: hint: the quotient
$$\frac{n^3+9n-17}{2n^2+1}$$ can be written as $$n/2+1/2\,{\frac {17\,n-34}{2\,{n}^{2}+1}}$$
