1 Introduction

Let \(\mathbb {Z}\), \(\mathbb {N}\), \(\mathbb {Q}\), \(\mathbb {R}\), \(\mathbb {C}\), \(\mathbb {P}\) be the sets of all integers, positive integers, rational numbers, real numbers, complex numbers and primes, respectively. Suppose that \(\ell \) is a fixed odd positive integer.

The first work on the title equation was done by C. Skinner who was a high school student in 1987/88. He was only 15 years old. In 1989, C. Skinner [10] proved that if \(p\ne 2\), then the equation

$$\begin{aligned} x^2=4p^n-4p+1, \, \, p\in \mathbb {P},\, x,n\in \mathbb {N},\,\,\,n\ge 1 \end{aligned}$$
(1.1)

has only the solutions

$$\begin{aligned} (x,n)= {\left\{ \begin{array}{ll} (1,1), (5,2), (31,5), \qquad \qquad \quad \quad \, \, \, \text {if } p=3, \\ (1,1), (9,2), (559,7), \qquad \qquad \quad \quad \text {if } p=5,\\ (1,1), (2p-1,2),\quad \qquad \qquad \quad \quad \, \, \, \text {if } p>5. \end{array}\right. } \end{aligned}$$

To solve the equation (1.1) for all odd p primes, he used unique factorization of ideals along with linear recurrences and congruences. At the same time, P.-Z. Yuan was also interested in the title equation with \(\ell =1\) due to the group theoretical property of the solutions of generalized Ramanujan-Nagell equation. In the same year, P.-Z. Yuan [14] proved that if \(\ell =1\) and \(p\ne 2\), then the equation

$$\begin{aligned} x^2=4p^n-4p^m+\ell ^2, \, \, p\in \mathbb {P},\, x,m,n\in \mathbb {N},\,\,\gcd (x,\ell )=1,\,\,m<n \end{aligned}$$
(1.2)

has only the solutions

$$\begin{aligned} (x,m,n)= {\left\{ \begin{array}{ll} (5,1,2), (31,1,5), \qquad \qquad \quad \quad \, \, \, \text {if } p=3, \\ (9,1,2), (559,1,7), \qquad \qquad \quad \quad \text {if } p=5,\\ (2p^r-1,r,2r),\,\, \text {for any } r\in \mathbb {N}, \, \, \,\,\,\, \text {otherwise}. \end{array}\right. } \end{aligned}$$

In 2002, F. Luca [9] considered the equation (1.2) where \(\ell =1\) and p is a prime power. Referring the solutions \(m=n\), \(x=1\) and \(n=2m\), \(x=2p^m-1\) for all \(m\ge 0\) as trivial, he proved that the only non-trivial solutions of equation (1.2) with p a prime power and \(n\ge m\ge 0\) but \((n,m)\ne (1,0)\) are \((x,p,m,n)=(37,7,0,3),(5,2,1,3),(11,2,1,5),(181,2,1,13),(31,3,1,5),(559,5,1,7).\) The proof was an interesting combination of standard algebraic number theory with previous results, mainly found in the important paper of Y. F. Bilu, G. Hanrot and P. M. Voutier [2] concerning the primitive divisors of Lucas and Lehmer numbers. We also recall that all the solutions of the analogous Diophantine equation

$$\begin{aligned} x^2=4p^n+4p^m+1 \end{aligned}$$

where found, for \(m=1\) and \(m=2\), by N. Tzanakis and J. Wolfskill in [12], and for general m, by M.-H. Le in [7].

In 2017, M. A. Bennett and A. M. Scheerer [1] considered a more general equation with the form

$$\begin{aligned} x^2=Np^n+Mp^m+\ell ^2,\,\,p\in \mathbb {P},\,\,x,\ell ,m,n\in \mathbb {N},\,m<n, \end{aligned}$$
(1.3)

where MN are nonzero integers with \(N\ge 1\). They proved that if \(p\ne 2\) and

$$\begin{aligned} \max \{|M|,N,\ell ^2\} \le p-1, \end{aligned}$$
(1.4)

then the solutions (pxmn) of (1.3) satisfy either

$$\begin{aligned} n=2m,\,\,\, \text {and}\,\,\ x=p^m\cdot x_0\pm \ell ,\,\,\,\ell , x_0\in \mathbb {Z}\,\,\text {with}\,\,\max \{x_0^2,2\ell x_0\}<p \end{aligned}$$

or

$$\begin{aligned} m\le 3. \end{aligned}$$

Their proofs were based upon Padé approximation to the binomial functions.

In this paper, we consider the equation (1.3) where \(\ell >1\) odd, \(M=-4\) and \(N=4\). We first give the relation between (1.2) and generalized Ramanujan-Nagell equation as follows:

Theorem 1.1

The Diophantine equation (1.2) has a solution (pxmn) with \(\ell ^2<4p^m\) (or \(\ell ^2>4p^m\)) if and only if the equation

$$\begin{aligned} X^2+(4p^m-\ell ^2)=4p^Z,\, X,Z\in \mathbb {N} \end{aligned}$$
(1.5)

(or

$$\begin{aligned} X^2-(\ell ^2-4p^m)=4p^Z,\, X,Z\in \mathbb {N}\,\, \end{aligned}$$
(1.6)

has a solution (XZ) with \(Z>m\). Moreover, if the above condition holds, then \((x,n)=(X,Z).\)

Next, by Theorem 1.1, using some classical results on the generalized Ramanujan-Nagell equation, all solutions of (1.2) with \(\ell ^2<4p^m\) can be derived.

Theorem 1.2

For \(\ell >1\), the Diophantine equation (1.2) has only the following solutions (pxmn) with \(\ell ^2<4p^m:\)

  • \(\ell =3, \, p=2, \, (x,m,n)=(5,2,3), (11,2,5), (181,2,13), (45,3,9).\)

  • \(\ell =5, \, p=2, \, (x,m,n)=(11,3,5), (181,3,13).\)

  • \(\ell =5, \, p=3, \, (x,m,n)=(31,2,5).\)

  • \(\ell =9, \, p=5, \, (x,m,n)=(559,2,7).\)

  • \(\ell =11, \, p=2, \, (x,m,n)=(181,5,13).\)

For any fixed \(\ell \), let \(p_1^{m_1},\cdots , p_r^{m_r}\) denote all prime powers satisfying \(\ell ^2>4p_i^{m_i}\) and \(p_i\not \mid \ell \) \((i=1,\cdots ,r)\). By Theorem 1.1, all the solutions (pxmn) of (1.2) with \(\ell ^2>4p^m\) and \((p,m)=(p_i,m_i)\) \((i=1,\cdots ,r)\) can be determined by solving the equations

$$\begin{aligned} X^2-(\ell ^2-4p_i^{m_i})=p_i^Z,\,X,Z\in \mathbb {N},\,i=1,\cdots ,r. \end{aligned}$$
(1.7)

Finally, as an example of using the above method, we find all solutions (pxmn) of (1.2) for \(\ell \in \{5,7\}\).

Theorem 1.3

For \(\ell =5\), the Diophantine equation (1.2) has only the following solutions:

  • \(p=2, \, (x,m,n)=(11,3,5), (181,3,13), (7,1,3), (9,1,4),(23,1,7).\)

  • \(p=3, \, (x,m,n)=(31,2,5), (7,1,2), (11,1,3).\)

Theorem 1.4

For \(\ell =7\), the Diophantine equation (1.2) has only the following solutions:

  • \(p=2, \, (x,m,n)=(13,1,5), (17,2,6), (9,3,4), (23,3,7).\)

  • \(p=3, \, (x,m,n)=(11,2,3), (19,1,4).\)

  • \(p=11, \, (x,m,n)=(73,1,3).\)

2 Preliminaries

Let D be an odd positive integer.

Lemma 2.1

(Theorem 2 of [4]) The equation

$$\begin{aligned} X^2+D=4\cdot 2^Z, \, X,Z\in \mathbb {N} \end{aligned}$$

has at most one solution (XZ), except for the following cases:

  • \(D=7,\, (X,Z)=(1,1),(3,2),(5,3),(11,5),(191,13).\)

  • \(D=23,\,(X,Z)=(3,3),(45,9).\)

  • \(D=2^{s+2}-1,\,(X,Z)=(1,s),(2^{s+1}-1,2s)\) where s is a positive integer with \(s>1\).

Lemma 2.2

(Theorem 2 of [4]) If p is an odd prime with \(p\not \mid D\), then the equation

$$\begin{aligned} X^2+D=4p^Z,\,X,Z\in \mathbb {N} \end{aligned}$$

has at most one solution (XZ), except for the following cases:

  • \(D=11, p=3,\, (X,Z)=(1,1),(5,2),(31,5).\)

  • \(D=19,p=5,\,(X,Z)=(1,1),(9,2),(559,7).\)

  • \(D=4p^{s}-1,\,(X,Z)=(1,s),(2p^{s}-1,2s)\) where s is a positive integer with \(s>1\).

Lemma 2.3

([11]) For \(D\in \{9,17,33,41\}\), the equation

$$\begin{aligned} X^2-D=4\cdot 2^Z,\,X,Z\in \mathbb {N} \end{aligned}$$

has only the following solutions:

  • \(D=9,\, (X,Z)=(5,2).\)

  • \(D=17,\,(X,Z)=(5,1),(7,3),(9,4),(23,7).\)

  • \(D=33,\,(X,Z)=(7,2),(17,6).\)

  • \(D=41,\,(X,Z)=(7,1),(13,5).\)

Lemma 2.4

([3]) The equation

$$\begin{aligned} X^2-13=4\cdot 3^Z,\, X,Z\in \mathbb {N} \end{aligned}$$

has the only solutions \((X,Z)=(5,1),(7,2),(11,3)\).

Lemma 2.5

([12]) If \(q>3\), then the equation

$$\begin{aligned} x^2=4q^n+4q+1,\,\,x,n\in \mathbb {N},\,n>1 \end{aligned}$$

has the only solution \((x,n)=(2q+1,2).\)

Lemma 2.6

([7]) The equation

$$\begin{aligned} x^2=4q^n+4q^m+1,\,\,x,m,n\in \mathbb {N},\,\,n>m>1,\,\gcd (m,n)=1 \end{aligned}$$

has the only solution (xm, , n).

Lemma 2.7

The equation

$$\begin{aligned} X^2-37=4\cdot 3^Z,\, X,Z\in \mathbb {N} \end{aligned}$$
(2.1)

has the only solutions \((X,Z)=(7,1),(19,4)\).

Proof

We now assume that (XZ) is a solution of (2.1) with \((X,Z)\ne (7,1)\) and (19, 4). Then we have

$$\begin{aligned} X^2=4\cdot 3^Z+4\cdot 3^2+1,\, Z>2. \end{aligned}$$
(2.2)

However, by [12], we see from (2.2) that \(2\not \mid Z\), and by [7], it is impossible. Thus, the lemma is proved. \(\square \)

To prove the subsequent Lemma 2.11, the following lemmas are introduced.

Lemma 2.8

(Theorem 10.9.1 and 10.9.2 of [5])

$$\begin{aligned} u^2-Dv^2=1,\,\,u,v\in \mathbb {Z} \end{aligned}$$
(2.3)

has positive integer solutions (uv), and it has a unique positive integer solution \((u_1,v_1)\) such that \(u_1+v_1\sqrt{D}\le u+v\sqrt{D}\), where (uv) through all positive integer solutions of (2.3). Every solution (uv) of (2.3) can be expressed as

$$\begin{aligned} u+v\sqrt{D}=\pm (u_1+v_1\sqrt{D})^r,\,\, r\in \mathbb {Z}. \end{aligned}$$

Lemma 2.9

([8, 13]) If D is not a square, p is an odd prime with \(p\not \mid D\) and the equation

$$\begin{aligned} A-DB^2=p^C,\,\,A,B,C\in \mathbb {Z},\, \gcd (A,B)=1,\,C>0 \end{aligned}$$
(2.4)

has solutions (ABC), then it has a unique positive integer solution \((A_1,B_1,C_1)\) such that \(C_1\le C\) and \(1<(A_1+B_1\sqrt{D})/(A_1-B_1\sqrt{D})< u_1+v_1\sqrt{D}\), where C through all solutions of (2.4), \((u_1,v_1)\) is the least solution of (2.3). The solution \((A_1,B_1,C_1)\) is called the least solution of (2.4). Every solution (ABC) of (2.4) can be expressed as

$$\begin{aligned} \begin{aligned}&C=C_1t,\, t\in \mathbb {N},\\&A+B\sqrt{D}=(A_1+\delta B_1\sqrt{D})^t(u+v\sqrt{D}),\, \delta \in \{1,-1\}, \end{aligned} \end{aligned}$$

where (uv) is a solution of (2.3).

For any algebraic number of \(\alpha \) of degree k over \(\mathbb {Q}\), let

$$\begin{aligned} h(\alpha )=\frac{1}{k} \left( \log |a_{0}|+ \sum _{i=1}^{k} \log \max \big \{1,|\alpha ^{(i)}|\big \}\right) \end{aligned}$$

be the absolute logarithmic height of \(\alpha \), where \(a_0\) is the leading coefficient of the minimal polynomial of \(\alpha \) over \(\mathbb {Z}\), and \(\alpha ^{(i)}\) \((i=1,2,\cdots , k)\) are the conjugates of \(\alpha \) in \(\mathbb {C}\). Let \(\alpha _1\), \(\alpha _2\) be two algebraic numbers with \(\min \{|\alpha _1|,|\alpha _2|\}\ge 1\), and let \(\log \alpha _1\), \(\log \alpha _2\) be any determinations of their logarithms. Further, let \(b_1\), \(b_2\) be positive integers, and let \(\Lambda =b_1\log \alpha _1-b_2\log \alpha _2\).

Lemma 2.10

If \(\Lambda \ne 0\) and \(\alpha _1,\alpha _2,\log \alpha _1,\log \alpha _2\) are real and positive, then

$$\begin{aligned} \log |\Lambda |\ge -19.7\times d^4\times (\log A_1)(\log A_2)\left( \max \left\{ 1,\dfrac{20}{d},0.38+\log E\right\} \right) ^2, \end{aligned}$$

where \(d=[\mathbb {Q}(\alpha _1,\alpha _2):\mathbb {Q}]/[\mathbb {R}(\alpha _1,\alpha _2):\mathbb {R}]\),

$$\begin{aligned} \begin{aligned}&\log A_j\ge \max \left\{ \dfrac{1}{d},\dfrac{|\log \alpha _j|}{d},h(\alpha _j)\right\} ,\, j=1,2,\\&E=\dfrac{b_1}{d\log A_2}+\dfrac{b_2}{d\log A_1}. \end{aligned} \end{aligned}$$

Proof

This lemma is the special case of Corollary 2 of [6] for \(m=20\). \(\square \)

Lemma 2.11

The equation

$$\begin{aligned} X^2-5=4\cdot 11^Z,\, X,Z\in \mathbb {N} \end{aligned}$$
(2.5)

has the only solutions \((X,Z)=(7,1),(73,3)\).

Proof

We assume that (XZ) is a solution of (2.5) with \((X,Z)\ne (7,1)\) and (73, 3). So, it is clear that \(2\not \mid X\). If \(2\mid Z\), then \(5=X^2-4\cdot 11^Z=X^2-(2\cdot 11^{Z/2})^2=(X-2\cdot 11^{Z/2})(X+2\cdot 11^{Z/2})\ge X+2\cdot 11^{Z/2}>5\), a contradiction. Hence we have \(2\not \mid Z\), \(Z\ge 5\) and \(X>73\). Let \(\lambda =(-1)^{(X-1)/2}\). Since \(X\equiv \lambda \pmod {4}\), \((3X+5\lambda )/4\) and \((X+3\lambda )/4\) are coprime positive integers. By (2.5), we get

$$\begin{aligned} \left( \dfrac{3X+5\lambda }{4}\right) ^2-5\left( \dfrac{X+3\lambda }{4}\right) ^2=11^Z. \end{aligned}$$
(2.6)

We see from (2.6) that the equation

$$\begin{aligned} A-5B^2=11^C,\,\, A,B,C\in \mathbb {Z},\, \gcd (A,B)=1,\, C>0 \end{aligned}$$
(2.7)

has a solution

$$\begin{aligned} (A,B,C)=\left( \dfrac{3X+5\lambda }{4},\dfrac{X+3\lambda }{4},Z\right) . \end{aligned}$$
(2.8)

Notice that \(4^2-5\cdot 1^2=11\) and \((u_1,v_1)=(9,4)\) is the least solution of the equation

$$\begin{aligned} u^2-5v^2=1,\,\, u,v\in \mathbb {Z}. \end{aligned}$$
(2.9)

By the definition given in Lemma 2.9, \((A_1,B_1,C_1)=(4,1,1)\) is the least solution of (2.7). Therefore, applying Lemma 2.9 to (2.8), we get either

$$\begin{aligned} \dfrac{3X+5\lambda }{4}+\dfrac{X+3\lambda }{4}\sqrt{5}=(4+\sqrt{5})^Z(u+v\sqrt{5}) \end{aligned}$$
(2.10)

or

$$\begin{aligned} \dfrac{3X+5\lambda }{4}+\dfrac{X+3\lambda }{4}\sqrt{5}=(4-\sqrt{5})^Z(u+v\sqrt{5}) \end{aligned}$$
(2.11)

where (uv) is a solution of (2.9).

When (2.10) holds, we have

$$\begin{aligned} \dfrac{3X+5\lambda }{4}-\dfrac{X+3\lambda }{4}=(4-\sqrt{5})^Z(u-v\sqrt{5}). \end{aligned}$$
(2.12)

Since \((3X+5\lambda )/4+(X+3\lambda )\sqrt{5}/4>0\) and \(4+\sqrt{5}>0\), we see from (2.10) that \(u+v\sqrt{5}>0\). Hence, by Lemma 2.8, we get

$$\begin{aligned} u+v\sqrt{5}=(9+4\sqrt{5})^r,\,\,r\in \mathbb {Z}. \end{aligned}$$
(2.13)

Further, since \(X>73\), by (2.10), (2.12) and (2.13), we have

$$\begin{aligned} 1<\dfrac{(3X+5\lambda )+(X+3\lambda )\sqrt{5}}{(3X+5\lambda )-(X+3\lambda )\sqrt{5}}=\left( \dfrac{X+\lambda \sqrt{5}}{X-\lambda \sqrt{5}}\right) \left( \dfrac{3+\sqrt{5}}{3-\sqrt{5}}\right) =\left( \dfrac{4+\sqrt{5}}{4-\sqrt{5}}\right) ^Z(9+4\sqrt{5})^{2r}<9+4\sqrt{5}.\nonumber \\ \end{aligned}$$
(2.14)

Since \(Z\ge 5\), we find from (2.14) that \(r<0\). Let

$$\begin{aligned}&s=-r, \end{aligned}$$
(2.15)
$$\begin{aligned}&\alpha =4+\sqrt{5},\,\, \bar{\alpha }=4-\sqrt{5}\,\, \beta =9+4\sqrt{5},\,\, \bar{\beta }=9-4\sqrt{5} \end{aligned}$$
(2.16)

Then, s is a positive integer, by (2.10), (2.12), (2.13), (2.15) and (2.16), we have

$$\begin{aligned} \dfrac{3X+5\lambda }{4}+\dfrac{X+3\lambda }{4}\sqrt{5}=\alpha ^Z\bar{\beta }^s,\,\,\dfrac{3X+5\lambda }{4}-\dfrac{X+3\lambda }{4}\sqrt{5}=\bar{\alpha }^Z {\beta }^r. \end{aligned}$$
(2.17)

Further, eliminating X in (2.17), we get

$$\begin{aligned} \alpha ^Z\bar{\beta }^s\left( \dfrac{3-\sqrt{5}}{2}\right) -\bar{\alpha }^Z {\beta }^s\left( \dfrac{3+\sqrt{5}}{2}\right) =\lambda \sqrt{5}. \end{aligned}$$
(2.18)

Let

$$\begin{aligned} \rho =\dfrac{3+\sqrt{5}}{2},\,\,\bar{\rho }=\dfrac{3-\sqrt{5}}{2}. \end{aligned}$$
(2.19)

Since \(\beta =\rho ^3\) and \(\bar{\beta }=\bar{\rho }^3\), by (2.18) and (2.19), we obtain

$$\begin{aligned} \alpha ^Z\bar{\rho }^{3s+1}-\bar{\alpha }^Z\rho ^{3s+1}=\lambda \sqrt{5}. \end{aligned}$$
(2.20)

Similarly, when (2.11) holds, we can deduce that

$$\begin{aligned} \alpha ^Z\bar{\rho }^{3s-1}-\bar{\alpha }^Z\rho ^{3s-1}=-\lambda \sqrt{5}, \end{aligned}$$
(2.21)

where s is a positive integer. The combination of (2.20) and (2.21) yields

$$\begin{aligned} \left| \alpha ^Z\bar{\rho }^{3s+\theta }-\bar{\alpha }^Z\rho ^{3s+\theta }\right| =\sqrt{5},\,\, \theta \in \{1,-1\}. \end{aligned}$$
(2.22)

Further, since \(\log (1+z)<z\) for any \(z>0\), by (2.22), we have

$$\begin{aligned} 0<\left| Z\log \dfrac{\alpha }{\bar{\alpha }}-2(3s+\theta )\log \rho \right| <\dfrac{\sqrt{5}}{\min \{\alpha ^Z\bar{\rho }^{3s+\theta },\bar{\alpha }^Z\rho ^{3s+\theta }\}}. \end{aligned}$$
(2.23)

Furthermore, since \(\min \{\alpha ^Z\bar{\rho }^{3s+\theta },\bar{\alpha }^Z\rho ^{3s+\theta }\}\ge \bar{\alpha }^Z\rho ^{3s+\theta }-\sqrt{5}>\dfrac{1}{2}\bar{\alpha }^Z\rho ^{3s+\theta }\) by (2.22), we get from (2.23) that

$$\begin{aligned} 0<\left| Z\log \dfrac{\alpha }{\bar{\alpha }}-2(3s+\theta )\log \rho \right| <\dfrac{2\sqrt{5}}{\bar{\alpha }^Z\rho ^{3s+\theta }}. \end{aligned}$$
(2.24)

Let \(\alpha _1=\alpha /\bar{\alpha }\), \(\alpha _2=\rho \) and

$$\begin{aligned} \Lambda =Z\log \alpha _1-2(3s+\theta )\log \alpha _2. \end{aligned}$$
(2.25)

By (2.16) and (2.19), we have \(\mathbb {Q}(\alpha _1,\alpha _2)=\mathbb {Q}(\sqrt{5})\),

$$\begin{aligned} \dfrac{[\mathbb {Q}(\alpha _1,\alpha _2):\mathbb {Q}]}{[\mathbb {R}(\alpha _1,\alpha _2):\mathbb {R}]}=2,\,\,h(\alpha _1)=\log (4+\sqrt{5}),\,\,h(\alpha _2)=\dfrac{1}{2}\log \left( \dfrac{3+\sqrt{5}}{2}\right) . \end{aligned}$$
(2.26)

Applying Lemma 2.10 to (2.26), we may choose that

$$\begin{aligned} d=2,\,\,\log A_1\ge \log (4+\sqrt{5}),\,\, \log A_2\ge \dfrac{1}{2}. \end{aligned}$$
(2.27)

Therefore, using Lemma 2.10, by (2.24), (2.25) and (2.27), we have

$$\begin{aligned} \begin{aligned}&\log |\Lambda |\ge -19.7\times 2^4\times (\log (4+\sqrt{5}))\times \dfrac{1}{2}\left( \max \{10,0.38+\log E\}\right) ^2\\&>-288.47\left( \max \{10,0.38+\log E\}\right) ^2, \end{aligned} \end{aligned}$$
(2.28)

where

$$\begin{aligned} E=Z+\dfrac{3s+\theta }{\log (4+\sqrt{5})}. \end{aligned}$$
(2.29)

By (2.24), (2.28) and (2.29), we get

$$\begin{aligned} \begin{aligned}&\log (2\sqrt{5})+288.47\left( \max \{10,0.38+\log E\})^2>\log (\bar{\alpha }^Z\rho ^{3s+\theta }\right) \\&=Z\log (4-\sqrt{5})+(3s+\theta )\log \rho>\left( Z+\dfrac{3s+\theta }{\log (4+\sqrt{5})}\right) (\log (4-\sqrt{5}))\\&>0.56E. \end{aligned} \end{aligned}$$
(2.30)

Therefore, by (2.30), we obtain

$$\begin{aligned} 2.67+515.13\left( \max \{10,0.38+\log E\}\right) ^2>E. \end{aligned}$$
(2.31)

If \(10<0.38+\log E\), then from (2.31) we get

$$\begin{aligned} 2.67+515.13(0.38+\log E)^2>E, \end{aligned}$$

whence we can deduce that

$$\begin{aligned} E<68260. \end{aligned}$$
(2.32)

If \(10\ge 0.38+\log E\), then (2.32) is still true. Therefore, by (2.29) and (2.32), we get \(Z<68260\). But, using MAPLE 2016, (2.5) has no solution (XZ) with \(3<Z<68260\). Thus, the lemma is proved. \(\square \)

3 Proofs of Theorems

Proof of Theorem 1.1

By comparing (1.1), (1.2), (1.5) and (1.6), the theorem follows easily. \(\square \)

Proof of Theorem 1.2

Since \(\ell >1\), by Theorem 1.1, if (1.2) has a solution (pxmn) with \(\ell ^2<4p^m\), then (1.5) or (1.6) has at least two solutions \((X,Z)=(X_1,Z_1)\) and \((X_2,Z_2)\) such that \((X_1,Z_1)=(\ell ,m)\) and \(1<X_1<X_2\). Therefore, by Lemmas 2.1 and 2.2, we obtain the theorem immediately. \(\square \)

Proof of Theorem 1.3

For \(\ell =5\), by Theorem 1.2, (1.2) has only the solutions

$$\begin{aligned} \begin{aligned}&p=2,\, (x,m,n)=(11,1,5),(181,3,13)\,\,\text {and}\\&p=3,\, (x,m,n)=(31,2,5) \end{aligned} \end{aligned}$$
(3.1)

with \(\ell ^2<4p^m.\)

On the other hand, since \(p^m=2,3\) and 4 are all prime powers satisfying \(\ell ^2>4p^m\) and \(p\not \mid \ell \), by Theorem 1.1, all the solutions (pxmn) of (1.2) with \(\ell ^2>4p^m\) can be determined by solving the equations

$$\begin{aligned}&X^2-17=4\cdot 2^Z, \, X,Z\in \mathbb {N}, \\&X^2-13=4\cdot 3^Z \, X,Z\in \mathbb {N} \end{aligned}$$

and

$$\begin{aligned} X^2-9=4\cdot 2^Z \, X,Z\in \mathbb {N}. \end{aligned}$$

Therefore, by Lemmas 2.3 and 2.4, (1.2) has only the solutions

$$\begin{aligned} \begin{aligned}&p=2,\, (x,m,n)=(7,1,3),(9,1,4),(23,1,7) \,\, \text {and}\\&p=3,\, (x,m,n)=(7,1,2),(11,1,3) \end{aligned} \end{aligned}$$
(3.2)

with \(\ell ^2>4p^m\). Thus, the combination of (3.1) and (3.2) yields the theorem. \(\square \)

Proof of Theorem 1.4

Using the same method as in the proof of Theorem 1.3, by Lemmas 2.3, 2.4, 2.7 and 2.11, we can obtain the theorem immediately. \(\square \)