Find all solutions of the equation $n^m=x^2+py^2$ which satisfy the following properties

Solution 1:

I considered a similar problem 12 years ago. The eqn,

$$7x^2 + y^2 = 2^n\tag{1}$$

for the special case $x=1$ is called the Ramanujan-Nagell equation. For general $x$, Euler gave a solution in terms of trigonometric functions (which nonetheless yield integer $x,y$). Even more generally, for integer $b>0$,

$$(2^{b+2}-1)x^2 + y^2 = 2^{bm+2}\tag{2}$$

I noticed that its odd solutions $x,y$ are given by, for integer $m>0$,

$$\begin{aligned} x\, &= \frac{2^{(bm+2)/2}}{h}\, |\sin\big(m\cdot\tan^{-1}(h)\big)|\\ y\, &= 2^{(bm+2)/2}\, |\cos\big(m\cdot\tan^{-1}(h)\big)|\\ h\, &= \sqrt{2^{b+2} - 1} \end{aligned}\tag{3}$$

where $|n|$ is the absolute value and $\tan^{-1}$ is the arctan function. For example, let $b = 1$, then solutions to,

$$7x^2 + y^2 = \color{blue}{2^{m+2}}$$

$$x_m = 1, 1, 1, 3, 1, 5, 7,\dots$$

$$y_m = 1, 3, 5, 1, 11, 9, 13,\dots$$

which are A077020 and A077021, respectively. Let $b = 2$, then solutions to,

$$15x^2 + y^2 = \color{blue}{2^{2m+2}}$$

$$x_m = 1, 1, 3, 7, 5, 33, 13,\dots$$

$$y_m = 1, 7, 11, 17, 61, 7, 251,\dots$$

where the $x_m$ is A106853 though it is defined there as "the expansion of $\frac{1}{(1-x(1-4x)}$". For $b=3$, the $x_m$ is A145978 and "the expansion of $\frac{1}{(1-x(1-8x)}$". And so on.

Notice that $(2)$ involves the Mersenne numbers $M_n = 2^n-1$. I cannot prove that $(3)$ gives the unique odd solution $x,y$, but it may be the case when $M_n$ is a Mersenne prime.

(P.S. The proven uniqueness for $p=7$ is more due to $\mathbb{Q}(\sqrt{-7})$ being a unique factorization domain, so the uniqueness of odd solutions may or may not extend to other Mersenne primes.)

Solution 2:

I think that this conjecture is not true in general. Let $p=3$ and $n=6$. Then $n^m=6^m=x^2+3y^2$ has no solution in integers $x,y$ for all odd $m\ge 1$ because of the following Theorem:

Theorem A positive integer $N$ is of the form $x^2 +3y^2$ iff ${\rm ord}_2(N)$ is even and for every prime $p \equiv−1 \mod 3$, ${\rm ord}_p(N)$ is even.

In fact, ${\rm ord}_2(6^m)=m$ is not even for $m$ odd. So there exists no $k\ge 1$ such that the equation has a solution for all $m\ge k$.