Can we find all $n$ such that there exists a prime number $p$ s.t. $1+p+p^2+\cdots+p^n$ is a perfect square, where $n$ is a natural number?

  1. For $n=1$, when $p=3$, $1+p=4$, which fits our standards.
  2. For $n=2$, we can know that $p^2<1+p+p^2<1+2p+p^2=(1+p)^2$, so $1+p+p^2$ cannot be a perfect square.
  3. For $n\geqslant3$, I want to use the identity $x^n-1=(x-1)(x^{n-1}+x^{n-2}+\cdots+1)$. If there exists a prime number $p$ s.t. $1+p+p^2+\cdots+p^n\;\;(n\geqslant3)$ is a perfect square, let $1+p+p^2+\cdots+p^n=m^2$. Then, $m^2(p-1)=p^{n+1}-1$.

For the $n\geqslant3$ case, I don't what can I do next, or should I split it into more cases. There are several links below that focus on particular cases of $n$.

$n=4$ link, another $n=4$ link.


  1. $\mathbb{N}=\mathbb{Z}^+$.
  2. I want to clarify that I couldn't find any other questions that are similar to my problem. I hope this is not another duplicate.
  • 5
    $\begingroup$ I think its "impossible" to completely solve this using elementary number theory. Similar question $\endgroup$ Jun 21 at 3:27
  • $\begingroup$ There has been a lot of research on determining positive integers $r$ and $n$ such that $1+r+r^2+\cdots+r^n$ is a square. I don't think a complete solution is known. $\endgroup$ Jun 21 at 6:27
  • $\begingroup$ I don't think it is possible. $\endgroup$ Jun 21 at 6:30
  • $\begingroup$ Possibly of interest: This MSE question and one of the linked articles. Four solutions are known, two for the squares and two for the cubes. Amusing pull quote: "Whilst we expect that there are, in fact, no more solutions, such a result is well beyond current technology." $\endgroup$ Jun 21 at 6:37
  • $\begingroup$ Following up: the linked paper uses the equation $(x^n-1)/(x-1)=y^q$. Your $p$ is their $x$, your $x$ is their $y$, $n$ is the same, and you have $q=2$. The two known solutions for $q=2$ are $(x,n,y)=(3,5,11)$ and $(7,4,20)$, and the known solutions for $q=3$ are $(x,n,y)=(18,3,7)$ and $(-19,3,7)$. Any unknown solution must have $q \geq 3$ ($q$ odd) and $|x|>10^4$, and $x$ has a prime divisor $p \equiv 1 \pmod q$. $x=p$ might be possible? In any case, this answers your original question; there are no other unknown solutions (in $\mathbb{Z}^+$) with squares, whether $x$ is prime or not. $\endgroup$ Jun 21 at 7:11

$$1 + p + p^2 + \dots + p^n = {{p^{n+1} - 1}\over{p-1}} = x^2,\quad x \in \mathbb{N}$$ You get an equation of the form $p(x^2 - p^n) = x^2 - 1$ (after fiddling with the terms in the equations). This means that for every $p$ must be such that it is less than $x^2 - 1$ as the above equation implies $p \mid x^2 - 1$ y FTA [Fundamental theorem of arithmetic, if you didn't understand the abbreviation] (Just as you have said in your question).

Also note that the other factor is $x^2 - p^n$, which means we must check for the least power of the prime less than $x^2$ and put a constraint on the power of $p^n$ in our equation.
Now checking the values of $x^2 - 1$ for every $x \in \mathbb{N}$:
$1^2 - 1 = 0$, but we can't take it as $\exists p : p \in \mathbb{P}, p <0$
$2^2 - 1 = 3$, and $2$ & $3$ are the only primes $\leq 3$, and $n = 1$ & $p = 3$ is an apt solution as you stated in the question.
$3^2 - 1 = 8$, the greatest prime factor of $8$ is $2$, but putting $p = 2$, you get the equation as $2(9 - 2^n) = 8$, which is impossible as $9 - 2^n$ is odd.
$4^2 - 1 = 15$, the only prime factors of $15$ are $3$ and $5$, so substituting each in the equation, you'll get $3(16 - 3^n) = 15$ and $5(16 - 5^n) = 15$, but in both cases, an $n$ is impossible as $16 - 3 = 13$ and $16 - 5 = 11$ aren't powers of $5$ and $3$ respectively.
$5^2 -1 = 24$, and the prime factors of $24$ include $2$ and $3$ only, so if you check, you'll get :

  • $2(25 - 2^n) = 24 \implies 25 = 2^n + 12$ (which is impossible as $2 \mid 2^n + 12$ but $2 \nmid 25$
  • $3(25 - 3^n) = 24 \implies 25 = 3^n + 8 \implies 3^n = 17$, but this is impossible as $17$ is not a power of $3$

$6^2 - 1 = 35 ,\implies$

  • $5(36 - 5^n) = 35 \implies 36 = 5^n + 7$, but again that is impossible as $29$ is not a power of $5$.
  • $7(36 - 7^n) = 35 \implies 36 = 7^n + 5$, which is again impossible as $31$ is not a power of $7$.

It's obvious through observation that if $\log_{p_1}{{x^2 - p_2}\over{p_1}} \notin \mathbb{N}, x^2 - 1 = {p_1}^{a}.{p_2}^{b}$, you can't have a solution.

These may be the same results as you must have obtained, and it's clear that the test is easier for those predecessors of squares that have only two prime factors (irrespective of power). Things will surely get harder as per @SatvikAcharya's comment beneath your question, for higher number of prime factors.

Thus the best hint I can give is: if you can find those predecessors of squares of the form $x = p_1p_2 : p_1, p_2 \in \mathbb{P}$, check if $\log_{p_1}{{x + 1 - p_2}\over{p_1}} \in \mathbb{N}$ or $\log_{p_2}{{x + 1 - p_1}\over{p_2}}\in \mathbb{N}$

Also, please check @EricSnyder's comment beneath this answer. You can see that in the case of three prime factors too one can find a solution. As I can see from it, $x^2 - 1$ is of the form $\prod\limits_{i=1}^{k} {p_1}^{m_i}$, so what you have to do is check if $\log_{p_j}\big{(}{{x^2 - {{x^2 - 1}\over{{p_j}^{m_j}}}}\over{p_j}}\big{)}, j \leq k \in \mathbb{N}$.

  • 1
    $\begingroup$ Interestingly, in this pattern the two solutions are $11^2-1=120 = 2^3 \cdot 3 \cdot 5 = 3 \cdot (121 - 3^4)$, and $20^2-1=399 = 7 \cdot 57 = 7 \cdot (400 - 7^3)$ $\endgroup$ Jun 21 at 7:39
  • $\begingroup$ I guess you're right, @EricSnyder .. but later I seem to notice that something is wrong in my answer (when I talk of the logarithms).. would you mind helping me out?? Also, please edit the answer if you could do it for me :) I am right now having my classes at school and hence can't keep visiting this site. $\endgroup$
    – Spectre
    Jun 21 at 7:49
  • $\begingroup$ @EricSnyder thanks, I have made the correction. $\endgroup$
    – Spectre
    Jun 21 at 8:42
  • $\begingroup$ And yes, @EricSnyder you are damn right 😂 $\endgroup$
    – Spectre
    Jun 21 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.