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.

Note:

  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.

Solution 1:

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