# Does $(n^p-1)/(n-1)=m^2$ have any positive integer solutions for $p\ge 2$ prime?

I was working on my partial answer to this question, which led me to consider the diophantine equation $$\frac{n^k-1}{n-1}=m^2$$ with $$k>1$$ odd. It's not too hard to prove that if $$(n,k)$$ is a solution, then if $$k$$ is a perfect square, $$(n,p^2)$$ is a solution for all $$p\mid k$$, and otherwise $$(n,p)$$ is a solution for $$p\mid k$$ the largest prime factor of $$k$$ with $$\operatorname{ord}_p(k)$$ odd.

Therefore, it is natural to ask whether there are any solutions with $$k=p$$ prime.

I have absolutely no idea to start. Perhaps note that $$(m^2)=\prod_{i=1}^{p-1}\left(n-\zeta_p^i\right)\subseteq\mathbb{Z}[\zeta_p],$$ and that all the ideals in this product are pairwise coprime. Therefore, they must all be squares of ideals in $$\mathbb{Z}[\zeta_p]$$. Also, if $$q\mid m$$ is prime, then $$q\equiv 1\pmod p$$ and the decomposition of $$(q)$$ in $$\mathbb{Z}[\zeta_p]$$ is $$(q) = \prod_{i=1}^{p-1}\left(q,n-\zeta_p^i\right),$$ whence $$\left(q,n-\zeta_p\right)^2\mid \left(n-\zeta_p\right)$$. I have no idea to continue. Perhaps if the class group of $$\mathbb{Q}(\zeta_p)/\mathbb{Q}$$ has odd order, we can use that $$(n-\zeta_p)$$ must be the square of a principal ideal?

Descending solutions: Suppose $$(n,k)$$ is a solution and $$p^2\mid k$$ for some prime $$p$$, then $$\frac{n^k-1}{n^{k/p^2}-1}\cdot \frac{n^{k/p^2}-1}{n-1} = m^2.$$ Let $$q\mid n^{k/{p^2}}-1$$ be prime, then $$\frac{n^k-1}{n^{k/p^2}-1}=\sum_{j=0}^{p^2}(n^{k/p^2})^j\equiv p^2\pmod q$$. Hence, the only prime that can possibly divide both $$\frac{n^k-1}{n^{k/p^2}-1}$$ and $$\frac{n^{k/p^2}-1}{n-1}$$ is $$p$$.

However, if $$p$$ divides both, let $$t:=\operatorname{ord}_p(n^{k/p^2}-1)$$ and let $$g$$ be a primitive root mod $$p^{t+3}$$. Write $$n^{k/p^2}\equiv g^a\pmod {p^{t+3}}$$, then $$\operatorname{ord}_p(a)=t-1$$, whence $$\operatorname{ord}_p(p^2a)=t+1$$, so $$\operatorname{ord}_p(n^k-1)=t+2$$. We conclude that $$\frac{n^k-1}{n^{k/p^2}-1}$$ and $$\frac{n^{k/p^2}-1}{n-1}$$ are both perfect squares.

In particular, $$(n,k/p^2)$$ is a solution. This way, we can remove the $$p^2$$ factors from $$n$$ one by one, until we're either left with an exponent which is itself a square of a prime (if $$k$$ is a perfect square) or with a square-free exponent.

Assume we end up with a solution $$(n,k)$$ with $$k$$ square-free. Let $$p\mid k$$ be the smallest prime factor of $$k$$. Note that the product of $$(n^k-1)/(n^{k/p}-1)$$ and $$(n^{k/p}-1)/(n-1)$$ is a perfect square, and that $$p$$ is the only prime that can possibly divide both. However, $$(p-1,k/p)=1$$, so if $$p\mid n^{k/p}-1$$ then $$p\mid n-1$$ and $$p\nmid (n^{k/p}-1)/(n-1)$$. Therefore, $$(n^{k/p}-1)/(n-1)$$ is a perfect square, and $$(n,k/p)$$ a new solution. This is how we can remove the primes from $$k$$ one by one, until only the largest remains.

• $n=3,k=5$ is a solution. No idea whether there are more. Sep 13, 2021 at 13:11
• There's probably a discussion of this question in Richard Guy's book, Unsolved Problems In Number Theory. Sep 13, 2021 at 13:31
• Here's a way we can maybe exclude primes $p\equiv 3\pmod 4$ for which $\mathbb{Q}(\sqrt{-p})$ has odd class number. Over $\mathbb{Z}[\sqrt{-p}]$ we can factor $\Phi_p=f\cdot g$ as the product of two irreducible polynomials of degree $(p-1)/2$. Now, $(f(n))\cdot (g(n))$ is the square of an ideal and the two factors are coprime, so $(f(n))=I^2$ for some ideal $I$. Because the class number is odd, $I$ is principal, so $(f(n))=(a+b\sqrt{-p})^2$. Because the unit group of $\mathbb{Z}[\sqrt{-p}]$ is $\{\pm 1\}$, we find that $f(n) = \pm[a+b\sqrt{-p}]^2$. Solve for $a$ and $b$. Sep 13, 2021 at 14:42
• Of course the above needs $p>3$ for the unit group to be $\{\pm 1\}$ Sep 13, 2021 at 14:49
• $n-1\equiv m\pmod 2$ or $n-1\equiv 0\pmod 2$ Sep 13, 2021 at 15:41

The only solutions to $$\frac{x^k-1}{x-1}=y^2$$ correspond to the identities $$\frac{3^5-1}{3-1}=11^2 \; \mbox{ and } \; \frac{7^4-1}{7-1}=20^2.$$ This was proved by Ljunggren in 1943 (the proof is in Norwegian which makes it arguably less accessible than desired). I'm embarrassed to admit that I haven't actually looked at the proof, but would suppose that it uses $$p$$-adic techniques along the lines of Skolem's method.

• Thanks for the reference! There is actually a Mathoverflow post which summarizes the proof: mathoverflow.net/questions/206645/… Sep 13, 2021 at 16:36
• Should the second identity be $\frac{7^4-1}{7-1}=20^2$? Sep 15, 2021 at 20:43