Find all positive integers $d$ such that $d$ divides both $n^{2}+1$ and $(n + 1)^{2}+1$ for some integer $n$.
Currently what I am thinking of is like manipulating $n^{2}+1$ and finding out the answer. Please guide me on how to move forward with this problem.
HINTS ONLY
Thanks for helping.
The idea is to reach at a constant divisible by $d$
If $d$ divides $a,b;d$ must divide $ax+by$ for integers $a,b,x,y$
So, $d$ must divide $1\cdot(n+1)^2+1(-1)\cdot(n^2+1)=2n+1$
So, $d$ must divide $n\cdot(2n+1)+(-2)\cdot(n^2+1)=n-2$
Follow the pattern to find $d$ must divide $5$