1 Introduction

Let \(\mathbb {Z}, \mathbb {N}\) be the sets of all integers and positive integers respectively. Let \(p\) be a fixed odd prime. Recently, there are many papers related to the equation

$$\begin{aligned} x^{2}+2^{a}p^{b}=y^{n}, \quad x,y,n\in \mathbb {N}, \quad \gcd (x,y)=1, \quad a,b\in \mathbb {Z},\quad a\ge 0, \quad b\ge 0,~ \quad n\ge 3. \end{aligned}$$
(1.1)

All solutions \((x,y,n,a,b)\) of (1.1) have been determined by [15] for \(p=3\), by [16] for \(p=5\), by [5] for \(p=11\), by [17] for \(p=13\), by [21] for \(p=19\) and by [8] for \(p=17,29,41\).

In this paper, we deal with the solutions of (1.1) for a general \(p\). Some special cases of (1.1) have been solved in early papers. By [11], (1.1) has no solution \((x,y,n,a,b)\) with \(a=b=0\). By [7] and [10], (1.1) has only the solutions \((x,y,n,a,b)=(5,3,3,1,0),(7,3,4,5,0)\) and \((11,5,3,2,0)\) with \(b=0\). Obviously, the remained cases of (1.1) can be classified into two equations

$$\begin{aligned} x^{2}+p^{b}=y^{n}, \qquad x,y,n,b\in \mathbb {N}, \qquad \gcd (x,y)=1, \qquad n\ge 3 \end{aligned}$$
(1.2)

and

$$\begin{aligned} x^{2}+2^{a}p^{b}=y^{n}, \qquad x,y,n,a,b\in \mathbb {N}, \qquad \gcd (x,y)=1, \qquad n\ge 3. \end{aligned}$$
(1.3)

Since \(n\ge 3\), we have either \(4|n\) or \(n\) has an odd prime divisor \(q\). Let \(z=y^{\frac{n}{4}}\) or \(y^{\frac{n}{q}}\) according as \(4|n\) or not. By (1.2) and (1.3), it is sufficient to solve the following four equations:

$$\begin{aligned} x^{2}+p^{b}&= z^{4}, \qquad x,z,b\in \mathbb {N}, \qquad \gcd (x,z)=1, \end{aligned}$$
(1.4)
$$\begin{aligned} x^{2}+p^{b}&= z^{q}, \qquad x,z,b\in \mathbb {N}, \qquad \gcd (x,z)=1, \end{aligned}$$
(1.5)
$$\begin{aligned} x^{2}+2^a p^{b}&= z^{4}, \qquad x,z,a,b\in \mathbb {N}, \qquad \gcd (x,z)=1, \end{aligned}$$
(1.6)

and

$$\begin{aligned} x^{2}+2^a p^{b}=z^{q}, \qquad x,z,a,b\in \mathbb {N}, \qquad \gcd (x,z)=1. \end{aligned}$$
(1.7)

Equations (1.4) and (1.5) have been studied by many authors. In [1], Arif and Abu Muriefah gave the complete list of solutions of (1.5) with \(b=2k+1\), for \(p\) odd prime, \(p\not \equiv 7 \pmod 8\) and \(q\ge 5\) prime to \(6h\), where \(h\) is the class number of the quadratic field \(Q(\sqrt{-p})\). In [24], the first author proved that the Eq. (1.5) has exactly one solution \((p,k,x,y)=(11,1,9324,443)\), where \(b=2k+1, q=3\) and \(p>3\) is an odd prime, \(p\not \equiv 7 \pmod 8\), \((h,3)=1, h\) is the class number of the quadratic field \(Q(\sqrt{-p})\) and gave the parameterizations of all the solutions for Eq. (1.5), where \(b=2k\), \(q=3\) and \(p>3\) is an odd prime. In [3], A. Bérczes and I. Pink solved the Eqs. (1.4) and (1.5) with \(b=2k\), where \(2\le p<100\) is prime, \((x,y)=1\) and \(n\ge 3\). Recently, X. Pan [25] proved that the equation \(x^2+p^{2m}=y^n, \gcd (x,y)=1,m>1,n>2,\gcd (n,6)=1\) has solutions if and only if \(p\) satisfies \(p^{2l+1}=(-1)^{\frac{p-1}{2}} \Big (1-\left( \begin{array}{l} q\\ 2 \end{array}\right) a^2+\cdots +(-1)^{\frac{q-1}{2}} \left( \begin{array}{l} q\\ q-1 \end{array}\right) a^{q-1}\Big )\), where \(q\) is an odd prime with \(q|n\), \(q>3\) and \(q,n,l,a\in \mathbb {N}\) with \(2|a\).

Now we introduce some notations and symbols. For any positive square free integer \(d\), let \(h(-4d)\) denote the class number of positive binary quadratic primitive forms of discriminant \(-4d\). For any positive odd integer \(k\), let

$$\begin{aligned} u_{k}&= \frac{1}{2}\left( \rho ^{k}+\overline{\rho }^k\right) , \qquad v_{k}=\frac{1}{2\sqrt{3}}\left( \rho ^{k}-\overline{\rho }^k\right) , \end{aligned}$$
(1.8)
$$\begin{aligned} u'_{k}&= \frac{1}{2}\left( \rho '^{k}+\overline{\rho '}^k\right) , \qquad v'_{k}=\frac{1}{2\sqrt{2}}\left( \rho '^{k}-\overline{\rho '}^k\right) , \end{aligned}$$
(1.9)
$$\begin{aligned} U_{k}&= \frac{1}{2\sqrt{3}}\left( \theta ^{k}+\overline{\theta }^k\right) , \qquad V_{k}=\frac{1}{2\sqrt{2}}\left( \theta ^{k}-\overline{\theta }^k\right) ,\quad \end{aligned}$$
(1.10)

where

$$\begin{aligned}&\rho =2+\sqrt{3}, \qquad \bar{\rho }=2-\sqrt{3}, \qquad \rho '=1+\sqrt{2}, \qquad \bar{\rho '}=1-\sqrt{2}, \nonumber \\&\theta =\sqrt{3}+\sqrt{2},\quad \overline{\theta }=\sqrt{3}-\sqrt{2}. \end{aligned}$$
(1.11)

By basic properties of Pell equations [23], \((u,v)=(u_{k},v_{k}),\; (k=1,3,5,\cdots ),\) \((u',v')=(u_{k}',v_{k}'),\; (k=1,3,5,\cdots )\), and \((U,V)=(U_{k},V_{k}),\; (k=1,3,5,\cdots )\) are all solutions of the equations

$$\begin{aligned} u^2-3v^2&= 1, \qquad u,v\in \mathbb {N},2|u, \end{aligned}$$
(1.12)
$$\begin{aligned} u'^2-2v'^2&= -1, \qquad u',v'\in \mathbb {N} \end{aligned}$$
(1.13)

and

$$\begin{aligned} 3U^2-2V^2=1, \qquad U,V\in \mathbb {N}, \end{aligned}$$
(1.14)

respectively. Let \(f,g\) be coprime nonzero integers. For any odd prime \(q\), let

$$\begin{aligned} A_{q}(f,g)&= \sum _{i=0}^{\frac{q-1}{2}}\left( \begin{array}{l}q \\ 2i \end{array}\right) f^{\frac{q-1}{2}-i}g^i,\nonumber \\ B_{q}(f,g)&= \sum _{i=0}^{\frac{q-1}{2}}\left( \begin{array}{l}q \\ 2i+1\end{array} \right) f^{\frac{q-1}{2}-i}g^i. \end{aligned}$$
(1.15)

In this paper, we prove some general results as follows:

Theorem 1.1

Equation (1.4) has only the following solutions:

  1. (i)

    \(p=23,~(x,z,b)=(6083,78,3).\)

  2. (ii)

    \(p=u_{k}',~(x,z,b)=(v_{k}'^{2}-1,v_{k}',2),\) where \(k>1\), if \(u_{k}'\) is an odd prime.

  3. (iii)

    \(p=2f^2-1,~(x,z,b)=(f^2-1,f,1),\) where \(f>1\), \(2f^2-1\) is an odd prime.

Theorem 1.2

If \(2|b\), then Eq. (1.5) has only the following solutions:

  1. (i)

    \(p=3,~q=3,~(x,z,b)=(46,13,4).\)

  2. (ii)

    \(p^s=|B_{q}(f^2,-1)|,~p\equiv (-1)^{\frac{p-1}{2}} \pmod q, ~(x,z,b)=(f|A_{q}(f^2,-1)|,f^2+1,2s),\) where \(f>0,2|f\), \(s\in \mathbb {N},\) and if \(p\) is a prime.

    If \(2\not \mid b\) and \(p\not \equiv 7 \pmod 8\), then the solutions \((x,z,b)\) satisfy \(q|h(-4p)\), except for

  3. (iii)

    \(p=3,~q=3,~(x,z,b)=(10,7,5).\)

  4. (iv)

    \(p=19,~q=5,~(x,z,b)=(22434,55,1).\)

  5. (v)

    \(p=3f^2+\lambda ,~q=3,~(x,z,b)=(8f^3+3\lambda f, 4f^2+\lambda ,1),\) where \(f>0,2|f\) and \(\lambda \in \{\pm 1\},\) if \(3f^2+\lambda \) is a prime.

Theorem 1.3

If \(p\not \equiv 7 \pmod 8\), then Eq. (1.6) has only the following solutions:

  1. (i)

    \(p=3,~(x,z,a,b)=(7,5,6,2).\)

  2. (ii)

    \(p=3,~(x,z,a,b)=(47,7,6,1).\)

  3. (iii)

    \(p=3,~(x,z,a,b)=(287,17,7,2).\)

  4. (iv)

    \(p=17,~(x,z,a,b)=(4785,71,9,3).\)

  5. (v)

    \(p=2^{2^{r-1}}+1, ~(x,z,a,b) =(2^{2^{r}+2}+2^{2^{r-1}+2}-1, 2^{2^{r-1}+1}+1, 2^{r-1}+4,1),\) where \(r\in \mathbb {N},\) and if \(2^{2^{r-1}}+1\) is a prime.

  6. (vi)

    \(p=2^{r}+1, ~(x,z,a,b)=(|2^{r-2}-2^{r}-1|,2^{r-1}+1, 2r,1),\) where \(r\in \mathbb {N},\) and if \(2^{2^{r-1}}+1\) is a prime.

  7. (vii)

    \(p=f^{2}-2^{2r-1},~(x,z,a,b)=(|f^{2}-2^{2r}|,f, 2r+1,1),\) where \(r\in \mathbb {N},\) \(2\not \mid f,\) and if \(f^{2}-2^{2r-1}\) is a prime.

Theorem 1.4

If \(2|b\), then Eq. (1.7) has only the following solutions:

  1. (i)

    \(p=3,~q=3,~(x,z,a,b)=(955,97,3,4).\)

  2. (ii)

    \(p=3,~q=3,~(x,z,a,b)=(2681,193,4,4).\)

  3. (iii)

    \(p=\frac{u_{k}}{2}, q=3, (x,z,a,b) =(8v_{k}^3+3v_{k},4v_{k}^2+1,2,2),\) where \(k>1\).

  4. (iv)

    \(p^s=V_{k},~q=3,~(x,z,a,b)=(8U_{k}^3-3U_{k},4U_{k}^2-1,1,2s),\) where \(s\in \mathbb {N}\) with \(2\not \mid s,\) and if \(p\) is a prime.

  5. (v)

    \(p^s=|B_{q}(f^2,-2^{2r})|,~p \equiv (-1)^{\frac{p-1}{2}} \pmod q, ~(x,z,a,b)=(f|A_{q}(f^2, -2^{2r})|,f^{2}+2^{2r}, 2r,2s),\) where \(2\not \mid f,r,s\in \mathbb {N},\) and if \(p\) is a prime.

  6. (vi)

    \(p^s=|B_{q}(f^2,-2^{2r+1})|,~p\equiv (-1)^{\frac{p^2+4p-5}{8}} \pmod q, \; (x,z,a,b)=(f|A_{q}(f^2, -2^{2r+1})|,f^{2}+2^{2r+1}, 2r+1,2s),\) where \(2\not \mid f,r\in \mathbb {Z}, r\ge 0\) and \(s\in \mathbb {N},\) and if \(p\) is a prime.

Theorem 1.5

The solutions of Eq. (1.7) with \(2\not \mid b\) satisfy \(q|h(-4p)\) or \(q|h(-8p)\) according to \(2|a\) or not, except for

  1. (i)

    \(p=3,~q=3,~(x,z,a,b)=(17,7,1,3).\)

  2. (ii)

    \(p=3,~q=3,~(x,z,a,b)=(35,13,2,5).\)

  3. (iii)

    \(p=3,~q=3,~(x,z,a,b)=(595,73,4,7)\).

  4. (iv)

    \(p=3,~q=3,~(x,z,a,b)=(39151,1153,5,5)\).

  5. (v)

    \(p=5,~q=5,~(x,z,a,b)=(401,11,1,3)\).

  6. (vi)

    \(p=3f^2+3f+1,~q=3,~(x,z,a,b)=(64f^3+96f^2+54f+11,16f^2+16f+5, 2,1),\) where \(f\ge 0,\) and if \(3f^2+3f+1\) is a prime.

  7. (vii)

    \(p^s=6f^2+6f+1,~q=3,~(x,z,a,b)=(64f^3+96f^2+42f+5,16f^2+16f+3, 1,s),\) where \(f>0,~s\in \mathbb {N}\) with \(2\not \mid s,\) and if \(6f^2+6f+1\) is a prime.

We organize this paper as follows. In Sect. 2, we recall and prove all necessary results that we will need to get our main results. The proofs of these results will be done in last sections.

2 Preliminaries

Lemma 2.1

([20]) The equation

$$\begin{aligned} X^{3}+1=3Y^{2}, \quad X,Y\in \mathbb {N} \end{aligned}$$
(2.1)

has no solution \((X,Y)\).

Lemma 2.1 comes from the case of \(D=3\) in the main theorem of [20], where the original result is more general.

Lemma 2.2

([19]) The equation

$$\begin{aligned} X^{3}-1=3Y^{2}, \qquad X,Y\in \mathbb {N} \end{aligned}$$
(2.2)

has no solutions \((X,Y)\).

Lemma 2.2 comes from the case \(D=n=3\) in the Sect. 1 of [19], where the original result is more general.

Lemma 2.3

([12]) Let \(D\) be a positive integer. The equation

$$\begin{aligned} X^{4}-DY^{2}=-1, \qquad X,Y\in \mathbb {N} \end{aligned}$$
(2.3)

has at most one solution \((X,Y)\). In particular, (2.3) has only the solution \((X,Y)=(1,1)\), for \(D=2\).

Lemma 2.3 comes from the case \(a=1\) in the equation \(a^2x^4+1=Dy^2\) of [12], where the original result is more general. When \(a=1,D=2\), we can find the only positive integer solution \((x,y)=(1,1)\).

Lemma 2.4

([14]) Let \(D_{1},D_{2}\) be positive integers with \(\min (D_{1},D_{2})>1.\) The equation

$$\begin{aligned} D_{1}X^{2}-D_{2}Y^{4}=1, \qquad X,Y\in \mathbb {N} \end{aligned}$$
(2.4)

has at most one solution \((X,Y)\). In particular, Eq. (2.4) has only the solution \((X,Y)=(1,1)\), for \((D_{1},D_{2})=(3,2)\).

Lemma 2.4 comes from [14], where the original result is more general. It is proved that the equation \(Ax^2-By^4=C\; (C=1,2,4)\) has at most one positive integer solution in some condition. When \(A=3,B=2,C=1\), we can find the only positive integer solution \((x,y)=(1,1)\).

Lemma 2.5

([18]) The equation

$$\begin{aligned} X^{m}-Y^{n}=1,\quad X,Y,m,n\in \mathbb {N},\quad \min (X,Y,m,n)>1 \end{aligned}$$
(2.5)

has only the solution \((X,Y,m,n)=(3,2,2,3).\)

Lemma 2.6

([13]) If \(n\ge 3,\) then the equation

$$\begin{aligned} 1+3X^{2}=4Y^{n},\quad X,Y\in \mathbb {N} \end{aligned}$$
(2.6)

has only the solution \((X,Y)=(1,1).\)

Lemma 2.6 comes from [13], where the original result is more general. In fact, it is proved that the equation \(1+Dx^2=4y^n(n\ge 3)\) has no positive integer solution with \(y>1\) such that \(D\equiv 3 \pmod 4\) and the class number of \(Q(\sqrt{-D})\) is not divisible by \(n\). When \(D=3\), \(1+3x^2=4y^n\) has the only positive integer solution \((x,y)=(1,1)\).

Lemma 2.7

([2, 20]) If \(n=3\), then the equation

$$\begin{aligned} X^n+1=2Y^{2}, \qquad X,Y\in \mathbb {N} \end{aligned}$$
(2.7)

has only the solution \((X,Y)=(1,1)\) and \((23,78)\). If \(n\ge 4\), then (2.7) has only the solution \((X,Y)=(1,1)\).

The first result of Lemma 2.7 comes from the case of \(D=2\) in the main theorem of [20] and the second result comes from the case of \(C=2\) in Theorem 1.1 of [2], where the original result is more general.

Lemma 2.8

([2, Theorem 8.4]) The equation

$$\begin{aligned} X^{2}-2^{m}=Y^{n}, \qquad X,Y,m,n\in \mathbb {N}, \qquad \gcd (X,Y)=1, \qquad Y>1, \qquad m>1, \qquad n>2 \end{aligned}$$
(2.8)

has only the solution \((X,Y,m,n)=(71,17,7,3)\).

Lemma 2.9

([2, Theorem 1.1]) If \(n\ge 4\), then the equation

$$\begin{aligned} X^{n}+Y^{n}=3Z^{2}, \qquad X,Y,Z\in \mathbb {Z}, \qquad XYZ\ne 0, \qquad \gcd (X,Y)=1 \end{aligned}$$
(2.9)

has no solution \((X,Y,Z)\).

Lemma 2.9 comes from the case \(C=3\) in Theorem 1.1 of [2], where the original result is more general.

Lemma 2.10

The equation

$$\begin{aligned} X^{2}-1=2^m3^{n}, \qquad X,m,n\in \mathbb {N}, \qquad X>1 \end{aligned}$$
(2.10)

has only the solutions \((X,m,n)=(5,3,1),(7,4,1)\), and \((17,5,2)\).

Proof

Let \((X,m,n)\) be a solution of (2.10). Since \(\gcd (6,X)=1\) and \(\gcd (X+1,X-1)=2\), we have \(m\ge 3\) and

$$\begin{aligned} X+1=\left\{ \begin{array}{llll}&{}2^{m-1}, \\ {} &{} 2\cdot 3^{n}, \end{array}\right. ~~~~ X-1=\left\{ \begin{array}{llll}&{}2\cdot 3^{n}, \\ {} &{} 2^{m-1}, \end{array}\right. \end{aligned}$$
(2.11)

hence we get

$$\begin{aligned} X=2^{m-2}+3^{n} \end{aligned}$$
(2.12)

and

$$\begin{aligned} 2^{m-2}-3^{n}=\pm 1. \end{aligned}$$
(2.13)

Applying Lemma 2.5 to (2.13), we obtain \((m,n)=(3,1), (4,1)\), and \((5,2)\). Thus by (2.12), the lemma is proved.\(\square \)

Lemma 2.11

The equation

$$\begin{aligned} |X^{2}-2^{m}|=3^{n}, \quad X,m,n \in \mathbb {N} \end{aligned}$$
(2.14)

has only the solutions \((X,m,n)=(1,2,1)\) and \((5,4,2)\).

Proof

Let \((X,m,n)\) be a solution of (2.14). Since \((\frac{2}{3})=-1\), where \((\frac{*}{*})\) is the Legendre symbol. From Eq. (2.14) by consideration modulo \(3\), we see that \(2|m\). Therefore, by (2.14), we get

$$\begin{aligned} X+2^{\frac{m}{2}}=3^{n}, \quad X-2^{\frac{m}{2}}=\lambda , \quad \lambda \in \mathbf \{ \pm 1 \}. \end{aligned}$$
(2.15)

Hence we obtain

$$\begin{aligned} 2X=3^{n}+\lambda \end{aligned}$$
(2.16)
$$\begin{aligned} 2^{\frac{m}{2}+1}=3^{n}-\lambda . \end{aligned}$$
(2.17)

Applying Lemma 2.5 to (2.17), we get \((X,m,n)=(1,2,1)\) and \((5,4,2)\). The lemma is proved.\(\square \)

Lemma 2.12

([9, Theorem 1-2]) Let \(D,k\) be positive integers such that \(k>1,2\not \mid k\) and \(\gcd (D,k)=1\). If the equation

$$\begin{aligned} X^{2}+DY^{2}=k^{Z}, \qquad X,Y,Z\in \mathbb {Z}, \qquad \gcd (X,Y)=1, \qquad Z>0 \end{aligned}$$
(2.18)

has solutions \((X,Y,Z)\), then every solution of (2.18) can be expressed as

$$\begin{aligned} Z&= Z_{1}t, \qquad t\in \mathbb {N}, \end{aligned}$$
(2.19)
$$\begin{aligned} X+Y\sqrt{-D}&= \lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-D})^{t}, \qquad \lambda _{1},\lambda _{2}\in \mathbf \{ \pm 1\}, \end{aligned}$$
(2.20)

where \((X_{1},Y_{1},Z_{1})\) is a positive integer solution of (2.18) satisfying \(Z_{1}|h(-4D)\).

Let \(\alpha ,\beta \) be algebraic integers. If \(\alpha +\beta \) and \(\alpha \beta \) are nonzero coprime integers and \(\frac{\alpha }{\beta }\) is not a root of unity, then \((\alpha ,\beta )\) is called a Lucas pair. Let \(A=\alpha +\beta \) and \(C=\alpha \beta \). Then

$$\begin{aligned} \alpha =\frac{1}{2}(A+\lambda \sqrt{B}), \qquad \beta =\frac{1}{2}(A-\lambda \sqrt{B}), \qquad \lambda \in \{\pm 1\}, \end{aligned}$$
(2.21)

where \(B=A^2-4C\). We will call \((A,B)\) the parameters of the Lucas pair \((\alpha ,\beta )\). Two Lucas pairs \((\alpha _{1}, \beta _{1})\) and \((\alpha _{2},\beta _{2})\) are equivalent if \(\frac{\alpha _{1}}{\alpha _{2}}= \frac{\beta _{1}}{\beta _{2}}=\pm 1\). Given a Lucas pair \((\alpha ,\beta )\), one defines the corresponding sequence of Lucas numbers by

$$\begin{aligned} L_{k}(\alpha ,\beta )=\frac{\alpha ^{k}-\beta ^{k}}{\alpha -\beta }, \qquad k=0,1,2,\cdot \cdot \cdot . \end{aligned}$$
(2.22)

For equivalent Lucas pairs \((\alpha _{1},\beta _{1})\) and \((\alpha _{2}, \beta _{2})\), we have \(L_{k}(\alpha _{1},\beta _{1})=\pm L_{k}(\alpha _{2},\beta _{2})\), for any \(k\ge 0\). A prime \(p\) is called a primitive divisor of \(L_{k}(\alpha ,\beta ),\; (k>1)\) if \(p|L_{k}(\alpha ,\beta )\) and \(p\not \mid BL_{1}(\alpha ,\beta )\cdot \cdot \cdot L_{k-1}(\alpha ,\beta )\). Then we have:

Lemma 2.13

([6, Theorem XIII]) If \(p\) is a primitive divisor of \(L_{k}(\alpha ,\beta )\), then \(p\equiv (\frac{B}{p}) \pmod k\).

A Lucas pair \((\alpha ,\beta )\) will be called a k-defective Lucas pair if \(L_{k}(\alpha ,\beta )\) has no primitive divisor. Furthermore, a positive integer k is called totally non-defective if no Lucas pair is k-defective.

Lemma 2.14

([22, Theorem 1]) Let \(k\) satisfy \(4<k\le 30\) and \(k\ne 6\). Then, up to equivalence, all parameters of k-defective Lucas pairs are given as follows:

  1. (i)

    \(k=5, (A,B)=(1,5),(1,-7),(2,-40),(1,-11),(1,-15),(12,-76), (12,-1364).\)

  2. (ii)

    \( k=7, (A,B)=(1,-7),(1,-19).\)

  3. (iii)

    \( k=8, (A,B)=(2,-24),(1,-7).\)

  4. (iv)

    \( k=10, (A,B)=(2,-8),(5,-3),(5,-47).\)

  5. (v)

    \(k=12, (A,B)=(1,5),(1,-7),(1,-11),(2,-56),(1,-15),(1,-19).\)

  6. (vi)

    \( k\in \{13,18,30\}, (A,B)=(1,-7).\)

Lemma 2.15

([4, Theorem D]). If \(k>30\), then \(k\) is totally non-defective.

3 Proof of Theorem 1.1

Let \((x,z,b)\) be a solution of (1.4). Since \(\gcd (x,z)=1\), we have \(2|xz\) and \(\gcd (z^2+x,z^2-x)=1\). By (1.4), we get

$$\begin{aligned} z^2-x=1, \qquad z^2+x=p^b, \end{aligned}$$
(3.1)

so we obtain

$$\begin{aligned} 2z^2=p^b+1 \end{aligned}$$
(3.2)

and

$$\begin{aligned} 2x=p^b-1. \end{aligned}$$
(3.3)

If \(b\) has an odd prime divisor \(l\), then from (3.2) we see that (2.7) has a solution \((X,Y)=(p^{\frac{b}{l}},z)\), for \(n=l\). Therefore, by Lemma 2.7, we get \(p=23, b=l=3\) and \(z=78\). Substituting it into (3.3), we obtain the solution (i).

If \(2|b\), then by Lemma 2.3 we have \(4\not \mid b.\) From what we discussed above, we exclude the case that \(b\) has an odd prime divisor. This implies that \(b=2\) and \((u',v')=(p,z)\) is a solution of (1.13). Hence, by (1.9), (1.11), and (3.3), we obtain the solution (ii).

Finally, if \(b=1\), then from (3.2) and (3.3) we obtain the solution (iii). Therefore, the proof of Theorem 1.1 is completed.

4 Proof of Theorem 1.2

According to the results in [25], Eq. (1.5) has only the solution (i) and (ii) with \(2|b\). Now, we consider the case that \(2\not \mid b\) and \(p\not \equiv 7 \pmod 8\). Since \(q\ge 3\), we see from (1.5) that \(2\not \mid z\) and the equation

$$\begin{aligned} X^2+pY^2=z^{Z}, \qquad X,Y,Z\in \mathbb {Z}, \qquad \gcd (X,Y)=1, Z>0 \end{aligned}$$
(4.1)

has the solution

$$\begin{aligned} (X,Y,Z)=(x,p^{\frac{b-1}{2}},q). \end{aligned}$$
(4.2)

Applying Lemma 2.12 to Eq. (4.2), we get

$$\begin{aligned} q&= Z_{1}t, \qquad t\in \mathbb {N}, \end{aligned}$$
(4.3)
$$\begin{aligned} x+p^{\frac{b-1}{2}}\sqrt{-p}&= \lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-p})^{t}, \qquad \lambda _{1},\lambda _{2}\in \{\pm 1\}, \end{aligned}$$
(4.4)

where

$$\begin{aligned} X_{1}^{2}+pY_{1}^{2}=z^{Z_{1}}, \qquad X_{1},Y_{1},Z_{1}\in \mathbb {N}, \quad \gcd (X_{1},Y_{1})=1 \end{aligned}$$
(4.5)

and

$$\begin{aligned} Z_{1}|h(-4p). \end{aligned}$$
(4.6)

Since \(q\) is an odd prime, by (4.3), we get either \(Z_{1}=q\) or \(Z_{1}=1\). Furthermore, using (4.6), we see that if \(q\not \mid h(-4p)\), then \(Z_{1}=1\) and \(t=q\). Hence, by (4.4) and (4.5), we have

$$\begin{aligned} x+p^{\frac{b-1}{2}}\sqrt{-p}=\lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-p})^q, \qquad \lambda _{1},\lambda _{2}\in \{\pm 1\} \end{aligned}$$
(4.7)

and

$$\begin{aligned} X_{1}^2+pY_{1}^2=z, \qquad X_{1},Y_{1}\in \mathbb {N}, \qquad \gcd (X_{1},Y_{1})=1. \end{aligned}$$
(4.8)

Let

$$\begin{aligned} \alpha =X_{1}+Y_{1}\sqrt{-p}, \qquad \beta =X_{1}-Y_{1}\sqrt{-p}. \end{aligned}$$
(4.9)

Then, by (4.8) and (4.9), \((\alpha ,\beta )\) is a Lucas pair with parameters

$$\begin{aligned} (A,B)=(2X_{1},-4pY_{1}^2). \end{aligned}$$
(4.10)

Let \(L_{k}(\alpha ,\beta )\), \((k=0,1,2,\cdots )\) denote the corresponding Lucas numbers. By (2.22) and (4.7), we have

$$\begin{aligned} p^{\frac{b-1}{2}}=Y_{1}|L_{q}(\alpha ,\beta )|, \end{aligned}$$
(4.11)

thus

$$\begin{aligned}&Y_{1}=p^{s}, \qquad s\in \mathbb {Z}, \qquad 0\le s \le \frac{b-1}{2}, \end{aligned}$$
(4.12)
$$\begin{aligned}&|L_{q}(\alpha ,\beta )|=p^{\frac{b-1}{2}-s} \end{aligned}$$
(4.13)

and the Lucas number \(L_{q}(\alpha ,\beta )\) has no primitive divisor. Therefore, by Lemmas 2.14 and 2.15, Eq. (4.10) gives

$$\begin{aligned} q=5, \qquad (A,B)=(12,-76) \end{aligned}$$
(4.14)

or

$$\begin{aligned} q=3. \end{aligned}$$
(4.15)

In the case (4.14), Eqs. (4.7) and (4.8) give the solution (iv). For the case (4.15), from (4.12) and (4.13), we have

$$\begin{aligned} |3X_{1}^2-p^{2s+1}|=p^{\frac{b-1}{2}-s}. \end{aligned}$$
(4.16)

If \(s<\frac{b-1}{2}\), then \(p=3\). If \((b-1)/2-s=1\), then \(|X_{1}^2-3^{2s}| = 1\). This is impossible. If \((b-1)/2-s>2\), then we have \(|X_{1}^2-3^{2s}| = 3^{(b-1)/2-s-1}\). Hence \(3|X_{1}\). This also leads to a contradiction. Therefore, Eq. (4.16) becomes

$$\begin{aligned} |X_{1}^2-3^{2s}|=3. \end{aligned}$$
(4.17)

Since \(|X_{1}^2-3^{2s}|\ge 1\) and \(3\not \mid X_{1}\), from (4.17) we deduce \(s=0, X_{1}=2\) and \(b=5\). Hence, we obtain the solution (iii).

If \(s=\frac{b-1}{2}\) and \(b>1\), then \(b\) has an odd prime divisor \(l\). From (4.16) we get

$$\begin{aligned} 3X_{1}^2=p^{b}+\lambda =(p^{\frac{b}{l}})^l+\lambda ^{l}, \qquad \lambda \in \{\pm 1\}. \end{aligned}$$
(4.18)

But, using Lemmas 2.1, 2.2, and 2.9, one can see that Eq. (4.18) has no solution.

If \(s=\frac{b-1}{2}\) and \(b=1\), then from Eqs. (4.7), (4.8), (4.12), and (4.16) we obtain the solution (v). Thus, this completes the proof of Theorem 1.2.

5 Proof of Theorem 1.3

Let \((x,z,a,b)\) be a solution of (1.6). Since \(2\not \mid xz\) and \(\gcd (z^2-x,z^2+x)=2\), from (1.6) we get either

$$\begin{aligned} z^2+x=2^{a-1}p^b, \qquad z^2-x=2 \end{aligned}$$
(5.1)

or

$$\begin{aligned} z^2+x=\left\{ \begin{array}{llll}&{}2^{a-1}, \\ {} &{} 2p^{b}, \end{array}\right. \qquad z^2-x=\left\{ \begin{array}{llll}&{}2p^{b}, \\ {} &{} 2^{a-1}. \end{array}\right. \end{aligned}$$
(5.2)

First, we consider the case (5.1). Then we have

$$\begin{aligned} z^2=2^{a-2}p^b+1 \end{aligned}$$
(5.3)

and

$$\begin{aligned} x=2^{a-2}p^b-1. \end{aligned}$$
(5.4)

From (5.3), when \(a=2\), we get \(z^2=p^b+1\). By Lemma 2.5, it gives no solution except for the case \(b=1\). But when \(b=1\), we get \(z^4-x^2=4p\). From here, since \(x\) and \(z\) are odd, then \(z^4-x^2\) is divided by 8. It is impossible. Hence \(a>2\). Furthermore, by (5.3), we get either

$$\begin{aligned} z+1=2^{a-3}p^b, \qquad z-1=2 \end{aligned}$$
(5.5)

or

$$\begin{aligned} z+1=\left\{ \begin{array}{llll}&{}2^{a-3}, \\ {} &{} 2p^{b}, \end{array}\right. \qquad z-1=\left\{ \begin{array}{llll}&{}2p^{b}, \\ {} &{} 2^{a-3}. \end{array}\right. \end{aligned}$$
(5.6)

One can exclude also the case \(a=3\) which leads to no solution. Therefore, we suppose \(a\ge 4\).

If Eq. (5.5) holds, then we have \(z=3\) and \(2^{a-3}p^b=4\). This implies a contradiction.

If (5.6) holds, then

$$\begin{aligned} z=2^{a-4}+p^b \end{aligned}$$
(5.7)

and

$$\begin{aligned} |2^{a-4}-p^b|=1. \end{aligned}$$
(5.8)

Since \(p\not \equiv 7 \pmod 8\), applying Lemma 2.5 to Eq. (5.8), we get the following four cases:

$$\begin{aligned} p&= 3, \qquad a=7, \qquad b=2; \end{aligned}$$
(5.9)
$$\begin{aligned} p&= 3, \qquad a=5, \qquad b=1; \end{aligned}$$
(5.10)
$$\begin{aligned} p&= 3, \qquad a=6, \qquad b=1; \end{aligned}$$
(5.11)

and

$$\begin{aligned} p=2^{2^{r}}+1, \qquad a=2^r+4, \qquad b=1, \qquad r\in \mathbb {N}. \end{aligned}$$
(5.12)

Hence, Eqs. (5.9)–(5.12) give the solutions (ii), (iii) and (v).

Next we consider the case (5.2). We have

$$\begin{aligned} z^2=2^{a-2}+p^b \end{aligned}$$
(5.13)

and

$$\begin{aligned} x=|2^{a-2}-p^b|. \end{aligned}$$
(5.14)

If \(2|b\), then from (5.13) we get

$$\begin{aligned} z+p^{\frac{b}{2}}=2^{a-3}, \qquad z-p^{\frac{b}{2}}=2, \end{aligned}$$
(5.15)

hence we obtain

$$\begin{aligned} z=2^{a-4}+1 \end{aligned}$$
(5.16)

and

$$\begin{aligned} p^{\frac{b}{2}}=2^{a-4}-1. \end{aligned}$$
(5.17)

Notice that \(a=4\) gives an impossibility. Therefore, we suppose \(a\ge 5\).

Since \(p\not \equiv 7 \pmod 8\), applying Lemma 2.5 to (5.17), we get \(p=3\), \(a=6\), and \(b=2\). Hence, by (5.16), we obtain the solution (i).

If \(2\not \mid b\) and \(b>1\), then \(b\) has an odd prime divisor \(l\). By (5.13), we have

$$\begin{aligned} z^{2}=2^{a-2}+(p^{\frac{b}{l}})^l. \end{aligned}$$
(5.18)

Applying Lemma 2.8 to Eq. (5.18) gives \(p=17,b=l=3,a=9\) and \(z=71\). Using Eq. (5.14), the solution (iv) is obtained.

If \(b=1\), then Eq. (5.13) becomes

$$\begin{aligned} p=z^{2}-2^{a-2}. \end{aligned}$$
(5.19)

If \(2|a\), i.e. \(a=2r\), then we see that Eq. (5.19) implies

$$\begin{aligned} z+2^{r-1}=p, \qquad z=2^{r-1}+1. \end{aligned}$$
(5.20)

Hence, one can use Eqs. (5.14) and (5.20) to obtain the solution (vi).

If \(2\not \mid a\), i.e. \(a=2r+1\), then by (5.14) and (5.19), we have the solution (vii). Therefore, this completes the proof of Theorem 1.3.

6 Proof of Theorem 1.4

Let \((x,z,a,b)\) be a solution of (1.7) with \(2|b\). First, we consider the case of \(2|a\). Then we have \(2\not \mid z\). Since \(h(-4)=1\), by Lemma 2.12, we have

$$\begin{aligned} x+2^{\frac{a}{2}}p^{\frac{b}{2}}\sqrt{-1}=\lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-1})^q, \qquad \lambda _{1},\lambda _{2}\in \mathbf \{ \pm 1\}, \end{aligned}$$
(6.1)

where

$$\begin{aligned} X_{1}^2+Y_{1}^2=z, \qquad X_{1},Y_{1}\in \mathbb {N}, \qquad \gcd (X_{1},Y_{1})=1. \end{aligned}$$
(6.2)

Let

$$\begin{aligned} \alpha =X_{1}+Y_{1}\sqrt{-1}, \qquad \beta =X_{1}-Y_{1}\sqrt{-1}. \end{aligned}$$
(6.3)

Then \((\alpha ,\beta )\) is a Lucas pair with parameters

$$\begin{aligned} (A,B)=(2X_{1},-4Y_{1}^2). \end{aligned}$$
(6.4)

Let \(L_{k}(\alpha ,\beta ), (k=0,1,2,\cdots )\) denote the corresponding Lucas numbers. By (1.15), (6.1), and (6.3), we have

$$\begin{aligned} x=X_{1}|A_{q}(X_{1}^2,-Y_{1}^2)| \end{aligned}$$
(6.5)

and

$$\begin{aligned} 2^{\frac{a}{2}}p^{\frac{b}{2}}=Y_{1}|L_{q}(\alpha ,\beta )|. \end{aligned}$$
(6.6)

Since \(2\not \mid L_{q}(\alpha ,\beta )\), we get from (6.6) that

$$\begin{aligned} Y_{1}=2^{\frac{a}{2}}p^m, \quad m\in \mathbb {Z},~~0\le m\le \frac{b}{2} \end{aligned}$$
(6.7)

and

$$\begin{aligned} |L_{q}(\alpha ,\beta )|=p^{\frac{b}{2}-m}. \end{aligned}$$
(6.8)

If \(m=0\), then from (6.5), (6.6), and (6.7) we obtain the solution (v).

If \(m>0\), then from (6.4) and (6.7), we see that \(L_{q}(\alpha ,\beta )\) has no primitive divisor. Therefore, by Lemmas 2.14 and 2.15, we get \(q=3\), and by (6.8), we have

$$\begin{aligned} |3X_{1}^2-2^{a}p^{2m}|=p^{\frac{b}{2}-m}. \end{aligned}$$
(6.9)

When \(m=\frac{b}{2}\), as \((\frac{-1}{3})=-1\), Eq. (6.9) implies \(a=2\) and

$$\begin{aligned} 4p^{b}-3X_{1}^{2}=1. \end{aligned}$$
(6.10)

Applying Lemma 2.6 to (6.10), we have \(b=2\). It implies that (1.12) has the solution \((u,v)=(2p^{\frac{b}{2}},X_{1})\). Therefore, we use Eq. (1.8) to obtain the solution (iii).

When \(0<m<\frac{b}{2}\), since \(p\not \mid X_{1}\), we see from (6.9) that \(p=3,b=2m+2\) and

$$\begin{aligned} X_{1}^{2}-2^{a}\cdot 3^{2m-1}=1. \end{aligned}$$
(6.11)

Applying Lemma 2.10 to (6.11), we obtain the solution (ii).

Second, we consider the case of \(2\not \mid a\). Since \(h(-8)=1,\) by Lemma 2.12, we use Eq. (1.7) to get

$$\begin{aligned} x+2^{\frac{a-1}{2}}p^{\frac{b}{2}}\sqrt{-2}=\lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-2})^q, \qquad \lambda _{1},\lambda _{2}\in \mathbf \{ \pm 1\}, \end{aligned}$$
(6.12)

where

$$\begin{aligned} X_{1}^2+2Y_{1}^{2}=z, \qquad X_{1},Y_{1}\in \mathbf N , \qquad \gcd (X_{1},Y_{1})=1. \end{aligned}$$
(6.13)

Let

$$\begin{aligned} \alpha =X_{1}+Y_{1}\sqrt{-2}, \qquad \beta =X_{1}-Y_{1}\sqrt{-2}. \end{aligned}$$
(6.14)

then \((\alpha ,\beta )\) is a Lucas pair with parameters

$$\begin{aligned} (A,B)=(2X_{1},-8Y_{1}^2). \end{aligned}$$
(6.15)

Let \(L_{k}(\alpha ,\beta ),\; (k=0,1,2,\cdots )\) denote the corresponding Lucas numbers. Thus, using Eqs. (6.12) and (6.14) we get

$$\begin{aligned} x=X_{1}|A_{q}(X_{1}^2,-2Y_{1}^2)| \end{aligned}$$
(6.16)

and

$$\begin{aligned} 2^{\frac{a-1}{2}}p^{\frac{b}{2}}=Y_{1}|L_{q}(\alpha ,\beta )|. \end{aligned}$$
(6.17)

Hence, Eq. (6.17) implies

$$\begin{aligned} Y_{1}=2^{\frac{a-1}{2}}p^{m},\quad m\in \mathbb {Z}, \qquad 0\le m\le \frac{b}{2} \end{aligned}$$
(6.18)

and

$$\begin{aligned} |L_{q}(\alpha ,\beta )|=p^{\frac{b}{2}-m}. \end{aligned}$$
(6.19)

If \(m=0\), we see from (6.18) and (6.19) that \(p\) is a primitive divisor of \(L_{q}(\alpha ,\beta )\). Hence, by Lemma 2.13, we get from (6.15) that \(p\equiv (\frac{-8}{p}) \pmod q\). Again here, Eqs. (6.13), (6.16) and (6.18) yield the solution (vi).

If \(0<m<\frac{b}{2}\), then \(L_{q}(\alpha ,\beta )\) has no primitive divisor. Therefore, we apply Lemmas 2.14 and 2.15 to (6.15) to get \(q=3\). Thus, Eq. (6.19) becomes

$$\begin{aligned} |3X_{1}^2-2Y_{1}^2|=|3X_{1}^2-2^ap^{2m}|=p^{\frac{b}{2}-m}. \end{aligned}$$
(6.20)

If \(m=\frac{b}{2}\), then we have

$$\begin{aligned} |3X_{1}^2-2^ap^{b}|=1. \end{aligned}$$
(6.21)

Since \(2\not \mid a\), by considerations modulo 8 to Eq. (6.21), we have \(a=1\) and

$$\begin{aligned} 3X_{1}^2-2p^{b}=1. \end{aligned}$$
(6.22)

Using Lemma 2.4, we see that \(4\not \mid b\). This implies that \(b=2s\), where \(s\) is a positive odd integer. Moreover, from (6.22) we deduce that \((U,V)=(X_{1},p^{s})\) is a solution of (1.14). Therefore, Eq. (1.10) implies the solution (iv). Thus, Theorem 1.4 is proved.

7 Proof of Theorem 1.5

Let \((x,z,a,b)\) be a solution of (1.7) with \(2\not \mid b\). First, we consider the case of \(2|a\). Then, from Lemma 2.12 and Eq. (1.7) we deduce

$$\begin{aligned} q&= Z_{1}t, \qquad t\in \mathbb {N}, \end{aligned}$$
(7.1)
$$\begin{aligned} x+2^{\frac{a}{2}}p^{\frac{b-1}{2}}\sqrt{-p}&= \lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-p})^t, \qquad \lambda _{1},\lambda _{2}\in \{\pm 1\}, \end{aligned}$$
(7.2)

where

$$\begin{aligned} X_{1}^2+pY_{1}^2=z^{Z_{1}}, \qquad X_{1},Y_{1},Z_{1}\in \mathbb {N}, \qquad \gcd (X_{1},Y_{1})=1, \qquad Z_{1}|h(-4p). \end{aligned}$$
(7.3)

Now we assume that \(q\not \mid h(-4p)\). Then, Eqs. (7.1) and (7.3) imply \(Z_{1}=1\) and \(t=q\). Hence, Eqs. (7.2) and (7.3) give

$$\begin{aligned} x+2^{\frac{a}{2}}p^{\frac{b-1}{2}}\sqrt{-p}=\lambda _{1} (X_{1}+\lambda _{2}Y_{1}\sqrt{-p})^q, \qquad \lambda _{1},\lambda _{2}\in \{\pm 1\} \end{aligned}$$
(7.4)

and

$$\begin{aligned} X_{1}^2+pY_{1}^2=z, \qquad X_{1},Y_{1}\in \mathbb {N}, \qquad \gcd (X_{1},Y_{1})=1. \end{aligned}$$
(7.5)

Let \(\alpha ,\beta \) be defined as in (4.9). Then \((\alpha ,\beta )\) is a Lucas pair with parameters (4.10). Equation (7.4) implies

$$\begin{aligned} x=X_{1}|A_{q}(X_{1}^2,-pY_{1}^2)| \end{aligned}$$
(7.6)

and

$$\begin{aligned} 2^{\frac{a}{2}}p^{\frac{b-1}{2}}=Y_{1}|L_{q}(\alpha ,\beta )|. \end{aligned}$$
(7.7)

Thus, we have

$$\begin{aligned} Y_{1}=2^{\frac{a}{2}}p^{m},~~m \in \mathbb {Z}, \qquad 0\le m\le \frac{b-1}{2} \end{aligned}$$
(7.8)

and

$$\begin{aligned} |L_{q}(\alpha ,\beta )|=p^{\frac{b-1}{2}-m}. \end{aligned}$$
(7.9)

From (4.10) and (7.9), we see that \(L_{q}(\alpha ,\beta )\) has no primitive divisor. Therefore, by Lemmas 2.14 and 2.15, we get \(q=3\). Then, one can use Eqs. (7.6) and (7.9) to have

$$\begin{aligned} x=X_{1}|X_{1}^2-3pY_{1}^2|=X_{1}|X_{1}^2-2^a\cdot 3p^{2m+1}| \end{aligned}$$
(7.10)

and

$$\begin{aligned} |3X_{1}^2-pY_{1}^2|=|3X_{1}^2-2^ap^{2m+1}|=p^{\frac{b-1}{2}-m}. \end{aligned}$$
(7.11)

If \(m=\frac{b-1}{2}\), then equation (7.11) gives \(a=2\) and

$$\begin{aligned} 3X_{1}^2+1=4p^{b}. \end{aligned}$$
(7.12)

Since \(2\not \mid b\), applying Lemma 2.6 to (7.12), we get \(b=1\) and

$$\begin{aligned} p=\frac{1}{4}(3X_{1}^2+1). \end{aligned}$$
(7.13)

Thus, \(X_{1}=2f+1\), where \(f\) is a positive integer. Hence, by (7.5), (7.8), and (7.10), we obtain the solution (vi).

If \(m<\frac{b-1}{2}\), then equation (7.11) implies \(p=3\) and

$$\begin{aligned} |X_{1}^2-2^a\cdot 3^{2m}|=3^{\frac{b-1}{2}-m-1}. \end{aligned}$$
(7.14)

As \(2|a\) and \(|X_{1}^2-2^a\cdot 3^{2m}|>1\), from (7.14) we deduce that \(m=0\), \(\frac{b-1}{2}-1>0\) and

$$\begin{aligned} |X_{1}^2-2^a|=3^{\frac{b-1}{2}-1}. \end{aligned}$$
(7.15)

We apply Lemma 2.11 to Eq. (7.15) to obtain the solutions (ii) and (iii).

Next we consider the case of \(2\not \mid a\). Then we have

$$\begin{aligned} q&= Z_{1}t, \qquad t\in \mathbb {N}, \end{aligned}$$
(7.16)
$$\begin{aligned} x+2^{\frac{a-1}{2}}p^{\frac{b-1}{2}}\sqrt{-2p}&= \lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-2p})^t, \qquad \lambda _{1},\lambda _{2}\in \{\pm 1\}, \end{aligned}$$
(7.17)

where

$$\begin{aligned} X_{1}^2+2pY_{1}^{2}=z^{Z_{1}}, \qquad X_{1},Y_{1},Z_{1}\in \mathbb {N}, \qquad \gcd (X_{1},Y_{1})=1, \qquad Z_{1}|h(-8p). \end{aligned}$$
(7.18)

We now assume that \(q\not \mid h(-8p)\). Then, from (7.16), (7.17), and (7.18), we get \(Z_{1}=1,t=q,\)

$$\begin{aligned} x+2^{\frac{a-1}{2}}p^{\frac{b-1}{2}}\sqrt{-2p}=\lambda _{1}(X_{1}+\lambda _{2}Y_{1}\sqrt{-2p})^q, \qquad \lambda _{1},\lambda _{2}\in \{\pm 1\} \end{aligned}$$
(7.19)

and

$$\begin{aligned} X_{1}^2+2pY_{1}^{2}=z, \qquad X_{1},Y_{1}\in \mathbb {N}, \qquad \gcd (X_{1},Y_{1})=1. \end{aligned}$$
(7.20)

Let

$$\begin{aligned} \alpha =X_{1}+Y_{1}\sqrt{-2p}, \qquad \beta =X_{1}-Y_{1}\sqrt{-2p}. \end{aligned}$$
(7.21)

Then \((\alpha ,\beta )\) is a Lucas pair with parameters

$$\begin{aligned} (A,B)=(2X_{1},-8pY_{1}^2). \end{aligned}$$
(7.22)

Equations (7.19) and (7.21) give

$$\begin{aligned} x=X_{1}|A_{q}(X_{1}^2,-2pY_{1}^2)| \end{aligned}$$
(7.23)

and

$$\begin{aligned} 2^{\frac{a-1}{2}}p^{\frac{b-1}{2}}=Y_{1}|L_{q}(\alpha ,\beta )|. \end{aligned}$$
(7.24)

Therefore, we have

$$\begin{aligned} Y_{1}=2^{\frac{a-1}{2}}p^{m}, \quad m\in \mathbb {Z}, \qquad 0\le m \le \frac{b-1}{2} \end{aligned}$$
(7.25)

and

$$\begin{aligned} |L_{q}(\alpha ,\beta )|=p^{\frac{b-1}{2}-m}. \end{aligned}$$
(7.26)

From (7.22) and (7.26), we see that \(L_{q}(\alpha ,\beta )\) has no primitive divisor. Therefore, using Lemmas 2.14 and 2.15, we get

$$\begin{aligned} q=5, \qquad (2X_{1},-8pY_{1}^2)=(2,-40) \end{aligned}$$
(7.27)

or

$$\begin{aligned} q=3. \end{aligned}$$
(7.28)

If (7.27) holds, then we use Eqs. (7.20), (7.23), and (7.26) to obtain the solution (v).

If \(q=3\), then we have

$$\begin{aligned} x=X_{1}|X_{1}^2-6pY_{1}^2| \end{aligned}$$
(7.29)

and

$$\begin{aligned} |3X_{1}^2-2pY_{1}^2|=|3X_{1}^2-2^{a}p^{2m+1}|=p^{\frac{b-1}{2}-m}. \end{aligned}$$
(7.30)

When \(m=\frac{b-1}{2}\) and as \(2\not \mid a\), Eq. (7.30) gives \(a=1\) and

$$\begin{aligned} |3X_{1}^2-2p^{b}|=1. \end{aligned}$$
(7.31)

Since \(2\not \mid bX_{1}\), the solution (vii) comes from equations (7.29) and (7.31).

When \(0<m<\frac{b-1}{2}\), we get from (7.30) that \(p=3\) and

$$\begin{aligned} |X_{1}^2-2^a\cdot 3^{2m}|=3^{\frac{b-1}{2}-m-1}. \end{aligned}$$
(7.32)

As \(3\not \mid X_{1}\) and \((\frac{2}{3})=-1\), by (7.32) we have \(b=2m+3\) and

$$\begin{aligned} X_{1}^2-2^a\cdot 3^{2m}=1. \end{aligned}$$
(7.33)

Since \(2\not \mid a\), applying Lemma 2.10 to (7.33), we obtain the solution (iv).

When \(m=0\) and \(\frac{b-1}{2}>0\), we have \(p=3\) and

$$\begin{aligned} |X_{1}^2-2^a|=3^{\frac{b-1}{2}-1}. \end{aligned}$$
(7.34)

As \(2\not \mid a\) and \((\frac{2}{3})=-1\), we see from (7.34) that \(X_{1}=1,a=1\) and \(b=3\). Hence, we obtain the solution (i). To sum up, Theorem 1.5 is proved.