$\forall n\in\mathbb{Z}$, find the $\gcd(n^2+1, (n+1)^2+1)$? 
$\forall n\in\mathbb{Z}$, find the $\gcd(n^2+1, (n+1)^2+1)$. 

I think this is a simple exercise, but I get this: 
$(n+1)^2+1=n^2+2n+2$. 
$n^2+2n+2 = (n^2+1)+(2n+1)$ 
then $\gcd(n^2+1, (n+1)^2+1)=\gcd(n^2+1, 2n+1)$ 
and $\displaystyle n^2+1 = \frac{n(2n+1)}{2}+\left(-\frac{n}{2}+1\right)$ 
then $\gcd(n^2+1, 2n+1)=\gcd(2n+1, \frac{n}{2}-1)$. 
But gcd is on integer numbers and $\dfrac{n}{2}-1$ is not always an integer number, so, I need some help?

Let $d=\gcd(n^2+1, (n+1)^2+1)$
So $d$ divides their difference
$d|2n+1$ so by multiplication with $n$ one gets $d|2n^2+n$
But $d|2n^2+2$ so $d|n-2$ so $d|2n-4$ so $d|5$
By considering all the residues modulo $5$ of $n^2+1$ and $(n+1)^2+1$ we can see that $\gcd$ is $5$ if $n\equiv2$ mod $5$, and $1$ otherwise.
