$1+x+\ldots+x^n$ perfect square

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)$.


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:

  1. There are always the two trivial solutions $x=0$ and $x=-1$.

  2. If $n$ is a square, then $x=1$ is a third solution.

  3. 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$.

  4. 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$.

  5. 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$.

  6. 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$.

  7. 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.


If $a=3$,then $n=0,1,4$ are all the solutions.

$p(3)=1+3+…+3^n=\frac{3^{n+1}-1}{3-1}=y^2,3^{n+1}-1=2y^2$

Denote $m=n+1,t=\sqrt{-2}$, then $$3^m=1+2y^2$$ $$(1+yt)(1-yt)=(1+t)^m(1-t)^m$$ We get $$1+yt=±(1+t)^m,1-yt=±(1-t)^m$$ so $$1=±\frac{(1+t)^m+(1-t)^m}{2},y=±\frac{(1+t)^m-(1-t)^m}{2t}$$ We get $m=1,2,5$, and $|y|=1,2,11$.