1 Introduction

The class number problem of quadratic fields is one of the most intriguing unsolved problems in Number Theory and it has been the object of attention for many years of researchers. Ankeny et al. [1], Chakraborty et al. [5], Kishi et al. [14], Nagel [20], Soundararajan [25], Weinberger [26] and Yu [29] studied the class number problem of quadratic fields. It was proved by Nagel [20] that there are infinitely many quadratic number fields each with class number divisible by a given positive integer. Weinberger [26] showed that for all positive integers n, there are infinitely many real quadratic fields each with class number divisible by n. In [11], we have proved that there exist infinitely many imaginary quadratic fields whose class numbers are divisible by 3. Recently in [1013], we have found some useful results on the divisibility of class numbers of real and imaginary quadratic fields. The class numbers of quadratic fields can be used in study of Diophantine equations. On the other hand, the class numbers of quadratic fields can be determined by the solvability of Diophantine equations. Thus there has been considerable attention given to the investigation of relationship between the solvability of Diophantine equations and the class numbers of related quadratic fields. The journey to this investigation has been started in 1853 by Lebesgue [15] in which he discussed the solvability of the Diophatine equation \(x^2+D=y^n\). He proved, using an elementary factorization argument, that this equation has no solution for \(D = 1\), except \(x=0\) and \(y=1\). Many special cases of this equation have been considered over the several years, but most of the outcomes for general values of n are of honestly recent origin. Fermat showed, a proof is given in [9], that for \(D = 2\) and \(n = 3,\) this equation has only one solution, that is, \(x = 5, y = 3\). In 1943, Ljunggren [16] generalised Fermat’s result and proved that this equation has no solution when \(D = 2\) and \(x\ne 5\). In 1954, this result was alternatively established by Nagell [22]. In 1923, Nagell [21] proved that this equation has no solutions when \(D=3\). This result was duplicated by Brown [4] in 1975 and subsequently by Cohn [7] in 1993. Nagell [21] also proved that this equation has no solution for \(D=5\). In 1955, Nagell [23] showed that for \(D = 4\), this equation has only one solution, that is, \(x=2\) and \(y=11\). In 1992, Cohn [6] showed that for \(D=19,\) this equation has only solution: \(x=18, y=7, n=3\) and \(x=22434, y=55, n=5\). Finally, Cohn [8] published a historical survey of this equation in 1993. For any positive integer D, Wren [27] in 1973 and Blass [2] in 1976, proved the impossibility of the solutions to this equation when \(n=5\). After a couple of year, Blass and Steiner [3] discussed the insolvability of this equation when \(n=7\).

The primary objective of this paper is to investigate the relationship between solvability of the Diophantine equation \(x^2+D=y^n, D>1\) being an integer and the divisibility of the class number of the imaginary quadratic field \({\mathbb {Q}}( {\sqrt{-D} })\). This type of relationships can be found in [1719, 24, 28].

2 Main results

In this section we discuss and prove our main results. Throughout this section we consider \(K={\mathbb {Q}}( {\sqrt{-D} })\) and by h( K) we denote the class number of the quadratic field K.

Theorem 2.1

Let \(D\equiv 1, 2 \,( {mod\,4})\) be a square-free positive integer and \(n>1\) be an odd integer satisfying \(na^{n-1}\not \equiv \pm 1\,( {mod D}),\) for some integer a. If \( \gcd ( { n, h( K)})=1\), then the Diophantine equation

$$\begin{aligned} x^2+D=y^n \end{aligned}$$
(1)

has no solutions.

Proof

Let y be an even integer. Then \(y^n\equiv 0 ( {mod\,4})\) and thus Eq. (1) gives \(x^2\equiv 2, 3 (mod\,4)\).

If \(D\equiv 1\,(mod\,4),\) then Eq. (1) implies x is odd and thus \(x^2\equiv 1\, ( {mod\,4})\). This is a contradiction.

Again if \(D\equiv 2\, (mod\,4),\) then Eq. (1) implies x is even and thus \(x^2\equiv 0 \,( {mod\,4})\). This is again a contradiction.

Thus y must be an odd integer.

Suppose p be a prime number such that \(p\vert gcd ( {x, y})\), then by Eq. (1), \(p\vert D\) and thus \(p=D\). Therefore Eq. (1) implies \(D^2\vert D\). This is a contradiction. Thus \(gcd ( {x, y})=1\).

Suppose \(( {x_0 , y_0 })\) be an integral solution to the Eq. (1). Then by the above discussion, \(y_0 \) is odd and \(gcd ( {x_0 , y_0 })=1\).

Consider the following factorization in the ring of integers \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \) of the quadratic field K:

$$\begin{aligned} ( {x_0 +\sqrt{-D} })( {x_0 -\sqrt{-D} })=y_0^n \end{aligned}$$
(2)

If \(\mathcal {P}\) is a prime ideal in \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \) such that \(\mathcal {P}\) is a common divisor of the ideals \(( {x_0 +\sqrt{-D} })\) and \(( {x_0 -\sqrt{-D} )}\), then \(\mathcal {P} \vert ( {2x_0 }).\)

Also Eq. (2) gives \(\mathcal {P} \vert (y_0 )\). This implies \({\mathcal {P}} \not \mid ( 2)\) as \(y_0 \) is odd, and thus \(\mathcal {P} \vert (x_0 )\). This contradicts to the fact that \(\gcd ( {x_0 , y_0 })=1\). Therefore the ideals \(( {x_0 +\sqrt{-D} })\) and \(( {x_0 -\sqrt{-D} })\) are coprime to each other. Thus we can write

$$\begin{aligned}&( {x_0 +\sqrt{-D} })={\mathfrak {a}}^n\\&( {x_0 -\sqrt{-D} })={\mathfrak {b}}^n \end{aligned}$$

for some ideals \({\mathfrak {a}} \) and \({\mathfrak {b}}\) in \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \).

Since \(\gcd ( {n, h( K)})=1\), therefore \({\mathfrak {c}}^{h( K)}\) is a principal ideal for any ideal \({\mathfrak {c}}\) in \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \), and moreover \({\mathfrak {a}}^n\) and \({\mathfrak {b}}^n\) are principal ideals, so that the ideals \({\mathfrak {a}}\) and \({\mathfrak {b}}\) are principal. Furthermore, since 1 and \(-1\) are the only units in \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \), thus we have

$$\begin{aligned} ( {x_0 +\sqrt{-D} })=( {a+b\sqrt{-D} })^n \end{aligned}$$

for some \(a, b\in {\mathbb {Z}}\).

Comparing imaginary part, we see that

$$\begin{aligned} 1=\left( {{\begin{array}{l} n \\ 1 \\ \end{array} }}\right) a^{n-1}b-\left( {{\begin{array}{l} n \\ 3 \\ \end{array} }}\right) a^{n-3}b^3D+\cdots +( {-1})^{\frac{n-1}{2}}b^nD^{\frac{n-1 }{2}} \end{aligned}$$
(3)

Thus \(b\vert 1\) and hence \(b=\pm 1.\)

Now Eq. (3) implies \(\pm 1=\left( {{\begin{array}{l} n \\ 1 \\ \end{array} }}\right) a^{n-1}-\left( {{\begin{array}{l} n \\ 3 \\ \end{array} }}\right) a^{n-3}D+\cdots +( {-1})^{\frac{n-1}{2}}D^{\frac{n-1 }{2}}\). This implies \(na^{n-1}\equiv \pm 1 (mod D)\). This contradicts to the hypothesis.

This completes the proof. \(\square \)

As a consequence we have the following result.

Corollary 2.2

Let \(D\equiv 1, 2\, ( {mod\,4})\) be a square-free positive integer and p be an odd prime satisfying \(pa^{p-1}\not \equiv \pm 1\,( {mod D}),\) for some integer a. If \( x^2+D=y^p\) is has integral solution then \(p\vert h(K)\).

We now fix y as a prime, that is consider the Diophantine equation

$$\begin{aligned} x^2+D=p^n \end{aligned}$$
(4)

where p is a prime and \(n>\) 1 is an odd integer. Then the following cases arise:

  1. (a)

    \(D\equiv 0\,(mod\,4)\) if one of the following conditions is satisfied:

    1. (i)

      x is odd and \(p\equiv 1\, ( {mod\,4})\).

    2. (ii)

      x is even and \(p=2\)

  2. (b)

    \(D\equiv 1\, ( {mod\,4}) \) if x is even and \(p\equiv 1\, (mod\,4)\).

  3. (c)

    \(D\equiv 2\, ( {mod\,4}) \) if x is odd and \(p\equiv 3\, (mod\,4)\).

  4. (d)

    \(D\equiv 3 \,( {mod\,4}) \) if one of the following conditions is satisfied:

    1. (i)

      x is even and \(p\equiv 3\, (mod\,4)\)

    2. (ii)

      x is odd and \(p=2\)

We are now in a position to state and prove the following result.

Theorem 2.3

Let \(n>1\) be an odd integer, D be a square-free positive integer and p be a prime number satisfying the Eq. (4). The ideal class group of the imaginary quadratic field \({\mathbb {Q}}( {\sqrt{-D} })\) has an element of order n if one of the following conditions is satisfied:

  1. (I)

    x is an integer and satisfying \(x^2<\frac{p^n}{2}\).

  2. (II)

    x is an odd integer and \(p=2\) satisfying \( x^2<2^{n-1}\).

  3. (III)

    x is an even integer and \(p\equiv 1 ( {mod\,4})\) satisfying \( x^2<\frac{p^n}{p-1}\).

Proof

Let us first consider the conditions given in (I). Then by condition (c) and condition (i) of (d), we see that either \(D\equiv 2\,( {mod\,4})\) or \(D\equiv 3\,( {mod\,4})\) according as x is odd or even. In either cases, the ring of integers of \({\mathbb {Q}}( {\sqrt{-D} })\) is \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \).

Consider the following factorization in \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \):

$$\begin{aligned} ( {x+\sqrt{-D} })( {x-\sqrt{-D} })=p^n \end{aligned}$$
(5)

Since \(( {x+\sqrt{-D} })\) and \(( {x-\sqrt{-D} })\) are coprime as ideals in \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \), we have \(( {x+\sqrt{-D} })={\mathfrak {a}}^n\) and \(( {x-\sqrt{-D} })={\mathfrak {b}}^n\) for some ideals \({\mathfrak {a}}\) and \({\mathfrak {b}}\) in \({\mathbb {Z}}\left[ {\sqrt{-D} } \right] \) with \({\mathfrak {a}}{\mathfrak {b}}=(p)\). Thus the order of \( {\mathfrak {a}} \) in the ideal class group of \( {\mathbb {Q}}( {\sqrt{-D} })\) is a divisor of n.

Let \({\mathfrak {a}}^m=( {u+v\sqrt{-D} })\) for some \( u, v\in {\mathbb {Z}}\). Then

$$\begin{aligned} p^m=u^2+v^2D \end{aligned}$$
(6)

If \(v=0\), then \(p^m=u^2\). This contradicts to the fact that n is odd. Thus \( v\ne 0\) and hence Eq. (6) implies \(p^m\ge D\).

Again, \(x^2<\frac{p^n}{2}\) implies \(D>\frac{p^n}{2}\). Thus \(p^m\ge D>\frac{p^n}{2}\). This leads to a contradiction if \(m<n\). Hence \({\mathfrak {a}}^n=( {u+v\sqrt{-D} })\) and \({\mathfrak {a}}^m\) is not principal for any \(m<n\). Thus there is an element of order n in the ideal class group of \({\mathbb {Q}}( {\sqrt{-D} })\).

Similarly the result holds if we consider the conditions given in (II).

Finally we consider the conditions given in (III). Then by condition (b), we see that \(D\equiv 1(mod\,4)\). Thus the ring of integers of \({\mathbb {Q}}( {\sqrt{-D} })\) is \({\mathbb {Z}}\left[ {\frac{1+\sqrt{-D} }{2}} \right] \). In the ring \({\mathbb {Z}}\left[ {\frac{1+\sqrt{-D} }{2}} \right] \), we consider the factorization as given in the Eq. (5). However in this case the ideals \( {\mathfrak {a}} \) and \( {\mathfrak {b}} \) must be in \( {\mathbb {Z}}\left[ {\frac{1+\sqrt{-D} }{2}} \right] \).

Let \( {\mathfrak {a}}^m=( {\frac{u+v\sqrt{-D} }{2}}) \) for some \( u, v\in {\mathbb {Z}}\). Then

$$\begin{aligned} 4p^m=u^2+v^2D \end{aligned}$$
(7)

If \( v=0\), then \( 4p^m=u^2.\) This contradicts to the fact that n is odd. Thus \( v\ne 0 \) and hence Eq. (7) implies \( 4p^m\ge D\).

Again, \(x^2<\frac{p^n}{p-1} \) implies \(D>p^n( {\frac{p-2}{p-1}})\). Thus \( 4p^m\ge D>p^n( {\frac{p-2}{p-1}})\). This leads to a contradiction if \( m<n\). Thus \({\mathfrak {a}}^n=( {\frac{u+v\sqrt{-D} }{2}}) \) and \( {\mathfrak {a}}^m \) is not principal for any \( m<n\). Hence there is an element of order n in the ideal class group of  \( {\mathbb {Q}}( {\sqrt{-D} })\).

As a consequence we provide the following criteria on the solvability of the Diophantine Eq. (4). \(\square \)

Corollary 2.4

\(( {x_0 , y_0 }) \) is an integral solution of the Eq. (4), where \(n>1\) is an odd integer and D is a positive square-free integer if one of the following conditions is satisfied:

  1. (i)

    \(x_0 \) is an integer and \(y_0\) is a prime \(\equiv 3\, ( {mod\,4}) \) satisfying \(x_0^2 <\frac{y_0^n }{2}\).

  2. (ii)

    \(x_0\) is an odd integer and \(y_0 =2\) satisfying \(x_0^2 <2^{n-1}\).

  3. (iii)

    \(x_0\) is an even integer and \(y_0 \equiv 1\, ( {mod\,4})\) is a prime satisfying \(x_0 <\frac{y_0^n }{y_0 -1}\).