5. Find all positive integers $n$ such that $n^{4}-n^{3}+3 n^{2}+5$ is a perfect square.
Solution: Let $f(n)=4 n^{4}-4 n^{3}+12 n^{2}+20=4\left(n^{4}-n^{3}+3 n^{2}+5\right)$ and note that $\left(n^{4}-n^{3}+3 n^{2}+5\right)$ is a perfect square if and only if $f(n)$ is. First note that:
$$
\left(2 n^{2}-n+5\right)^{2}-f(n)=9 n^{2}-10 n+5=4 n^{2}+5(n-1)^{2}>0 \text {. }
$$

Also note that
$$
f(n)-\left(2 n^{2}-n+2\right)^{2}=3 n^{2}+4 n+16=2 n^{2}+(n+2)^{2}+12>0 .
$$

Therefore $\left(2 n^{2}-n+2\right)^{2}<f(n)<\left(2 n^{2}-n+5\right)^{2}$, so the only way $f(n)$ could be a perfect square is if it is $\left(2 n^{2}-n+3\right)^{2}$ or $\left(2 n^{2}-n+4\right)^{2}$. Solving $f(n)=\left(2 n^{2}-n+3\right)^{2}$ gives us the quadratic $n^{2}-6 n-11=0$ which has no integer solutions. Solving $f(n)=\left(2 n^{2}-n+4\right)^{2}$ gives us $5 n^{2}-8 n-4=(5 n+2)(n-2)=0$. which has only one integer solution $n=2$. Checking
$$
(2)^{4}-(2)^{3}+3(2)^{2}+5=25
$$
which is a perfect square. Therefore the only solution is $n=2$.