Find all positive integers $n$ such that $n^2 + 1$ is divisible by $n+ 1$
I know a lot about number theory, for example conjectures, theories, equations and so on. But I just can't solve this type of problems. Which algorithm should i use in order to solve them?
Hint. Note that $$\frac{n^2+1}{n+1}=\frac{n^2-1+2}{n+1}=n-1+\frac{2}{n+1}.$$