Problem Definition
Pell's equation is one of the oldest studied problem in number theory. For a positive square-free integer d, Pell's equation is \( x^2 - d y^2 =1 \), and the problem is to compute integer solutions x, y of the equation [7,9]. The earliest algorithm for it uses the continued fraction expansion of \( \sqrt{d} \) and dates back to 1000 a.d. by Indian mathematicians. Lagrange showed that there are an infinite number of solutions of Pell's equation. All solutions are of the form \( x_n + y_n \sqrt{d} = (x_1 + y_1 \sqrt{d})^n \), where the smallest solution, \( (x_1, y_1) \), is called the fundamental solution. The solution \( (x_1, y_1) \) may have exponentially many bits in general in terms of the input size, which is log d, and so cannot be written down in polynomial time. To resolve this difficulty, the computational problem is recast as computing the integer closest to the regulator \( R = \ln(x_1 + y_1 \sqrt{d}) \). In this representation solutions of Pell's...