TITLE: Find all square numbers $n$ such that $f(n)$ is a square number
QUESTION [5 upvotes]: Find all the square numbers $n$ such that $ f(n)=n^3+2n^2+2n+4$ is also a perfect square. 
I have tried but I don't know how to proceed after factoring $f(n)$ into $(n+2)(n^2+2)$. Please help me. 
Thanks.

REPLY [7 votes]: Your factoring seems to appear difficult to solve. 
Instead say $n=t^2$. 
If $t>1$, note that $f(t^2)=t^6+2t^4+2t^2+4$, and that $(t^3+t+1)^2=t^6+2t^4+t^2+2t^3+2t+1>f(t^2) >t^6+2t^4+t^2=(t^3+t)^2$ (since $2t^3-t^2+2t-3>0$ from here)
If $t<-1$, note that $(t^3+t-1)^2=t^6+2t^4+t^2-2t^3-2t+1>f(t^2) >t^6+2t^4+t^2=(t^3+t)^2$  (since $-2t^3-t^2-2t-3>0$ from here)
So $t=-1,0,1$.