find all $k$ such that $k^5+3$ is divisible by $k^2+1$ That's it. I have a solution with substitutions, but it's tedious and not too generic. Is there a solution using some cool theorem for polynomials divisibility?
 A: From $k^5+3=(k^2+1)(k^3-k)+k+3$ we see that $k^2+1\mid k^5+3$ implies $k^2+1\mid k+3$.  If $k+3\not=0$, we must have $k^2+1\le|k+3|\le|k|+3$, which can be rewritten as $|k|^2\le|k|+2$.  It's not hard to see that this implies $|k|\le2$, at which point one can simply check the five possible values of $k$ (remembering to check $k=-3$ as well).
Remark (added later): This approach extends to any pair of polynomials in $k$ (with integer coefficients):  If the polynomial division of $Q(k)$ by $P(k)$ leaves a nonzero remainder $R(k)$ of degree less than the degree of $P$, then the set of $k$ for which $P(k)\mid Q(k)$ is necessarily finite, limited to the integer roots of $R(k)$ and $k$'s satisfying the inequality $|P(k)|\le|R(k)|$. In any given case there may be other (e.g., congruence) considerations that limit the search more efficiently; for example, $P(k)=k^2+k+2$ is always even while $Q(k)=k^5+k^3+1$ is always odd, so we don't have to search at all. It'd be nice to have an example where there are some solutions to search for that are cumbersome for this approach to find but are nonetheless easy to pinpoint by another approach.
A: Since $$k^2+1\mid (k^2+1)(k^2-1)k = k^5-k$$ we have $$k^2+1\mid (k^5+3)-(k^5-k) = k+3$$
Now $$k^2+1\mid (k+3)(k-3)=k^2-9$$
So $$k^2+1\mid (k^2+1)-(k^2-9) =10$$
So $k^2+1\in\{1,2,5,10\}$ so $k\in\{0,\pm1,\pm2,\pm 3\}$. 
A: $\!\bmod k^2\!+\!1\!:\,\ \color{#c00}{k^2\equiv-1}\,\Rightarrow\, k^4\equiv 1\,\ $ so $\,\ \color{#0a0}0\equiv k(k^4)\!+\!3\equiv \color{#0a0}{k\!+\!3}$ 
therefore $\ \color{#0a0}{0\equiv (3\!+\!k)}(3\!-\!k)\equiv 9-\color{#c00}{k^2}\equiv 10,\ $  so $\,\ \bbox[5px,border:1px solid red]{k^2\!+\!1\mid 10}$
Remark $\ \color{#c00}{k^2\equiv -1}\,$ means $\,k\,$ behaves like $\,i\,$ so the above is essentially
$\qquad\qquad\qquad\quad\begin{align} &0\equiv  z \equiv 3\!+\!i^5 \equiv 3\!+\!i\\[.4em] 
\Rightarrow\ \ &0 \equiv z\bar z \equiv (3\!+\!i)(3\!-\!i) \equiv 10\end{align}$
which has a natural interpretation in Gaussian integer arithmetic (or complex numbers).
As for a "solution using polynomials", the above computation is generic and it translates to the following Euclidean gcd (or ideal) calculation with polynomials
$\qquad\qquad(x^2\!+\!1,\!\overbrace{x^5\!+\!3\!\!\!}^{\large\color{#c00}{x^2\ \equiv\ -1}})\, =\, (\!\overbrace{x^2\!+\!1}^{\large\color{#0a0}{x\ \equiv\ -3}},\,x\!+\!3)\, = \,(10,\,x\!+\!3)$
using Euclid's $\, (a,\,b) = (a,\, b\bmod a).\, $ We could go further and extract the Bezout relation giving $10$ as a linear combination of $\,x^2\!+\!1,\,x^5\!+\!3,\,$ but there is no need to do so for the problem at hand. 
A: Solution with substitutions.
If $k^5+3$ is divisible by $k^2+1$, it could be expressed as $(k^2+1)(k^3+n)$, which if expanded, leads us to $k^3+nk^2+n-3$.
Now let's make another substitution by introducing another variable $a: k=-(n+a)$, which will get us $-an^2+(1-2a^2)n-(a^3+3)$. It is solvable for $n$ only when $D\ge0$ or $-4a^2-12a+1\ge0$.
Roots of the last [expression turned into an] equation are $-3\pm\frac{\sqrt{10}}{2}$, and since we are looking only for integers, we need to check $a\in\{-3,-2,-1,0\}$.
Now we can start unrolling our substitutions. For all valid values of $a$, solve $-an^2+(1-2a^2)n-(a^3+3)$ for $n$, and get values of $k$ directly as $-(n+a)$
$$\begin {array} {r|r} \ equation & a & n & k\\
\hline
3n^2-17n+24=0 & -3 & 3 & 0 \\
3n^2-17n+24=0 & -3 & \frac83 & - \\
2n^2-7n+5=0 & -2 & 1 & 1 \\
2n^2-7n+5=0 & -2 & 2.5 & - \\
n^2-n-2=0 & -1 & -1 & 2 \\
n^2-n-2=0 & -1 & 2 & -1 \\
n-3=0 & 0 & 3 & -3 \\
\end {array}$$
