TITLE: $1+x+\ldots+x^n$ perfect square
QUESTION [10 upvotes]: Let $p$ be the polynomial $p(x)=1+x+\ldots+x^n$.
For which couples $(a, n)\in\mathbb{N}^2$, $p(a)$ is a perfect square? I'm particularly interested in $p(3)$.

REPLY [13 votes]: The Diophantine equation $f_n(x)=1+x+x^2+\cdots+x^{n-1}=y^2$. 
Ribenboim's book on Catalan's conjecture has a detailed 
analysis of this Diophantine equation. Except the cases noted below, there are no more non-trivial solutions.
Here are some of the easy cases:

There are always the two trivial solutions  $x=0$ and $x=-1$.
If $n$ is a square, then $x=1$ is a third solution.
For $n=3$, if $x\not=0$, then $-2|x|<x<2|x|$ implies
$(|x|-1)^2<1+x+x^2<(|x|+1)^2$ so $f_3(x)$ can only be the square  $x^2$.
This gives the other trivial solution $x=-1$.
For $n=4$,  look at Monthly problem 11203 (Feb. 2006) or Exercise 1.10
in Edward's book Fermat's Last Theorem. The only solutions are  $x=-1,0,1,7$.
For $n=5$,  see Ed Burger's book Exploring The Number Jungle (Exercise 12.11). By comparing $4f_5(x)$
with $(2x^2+x)^2$ and $(2x^2+x+1)^2$, we find that the only solutions are  $x=-1,0,3$.
For $n=6$, we factor $f_6(x)=f_2(x^3)f_3(x)$.
By the formula $2=f_2(x^3)-(x-1)f_3(x)$ we see that
$\gcd(f_2(x^3),f_3(x))$ divides 2. But $f_3(x)$ is always odd, so the gcd equals 1.
This forces $f_3(x)$ to be a square so we end up with the trivial solutions $x=0,-1$.
For $n=7$, if $x>5$ we have
$$(16x^3+8x^2+6x+5)^2< 256 f_7(x)< (16x^3+8x^2+6x+6)^2,$$
while
for $x<-4$ we get  $$(16x^3+8x^2+6x+5)^2< 256 f_7(x)< (16x^3+8x^2+6x+4)^2.$$
Check the values between and you find that there are only trivial solutions.

By this stage, elementary methods get tougher to push through.