#### Solving x^2-Dy^2=N, D > 0 and not a perfect square, N divisible by 4, |N| > 4

This finds the fundamental solutions, if any, of the diophantine equation x^{2}-Dy^{2}=N, when N is divisible by 4. These are the solutions (a,b) in each equivalence class as defined by Bengt Stolt with least b ≥ 0, where we have a ≥ 0 if the class is ambiguous. The solutions (x,y) in the class containing (a,b) are given by (x+y√D)/2=±{(a+b√D)/2}{(x_{1}+y_{1}√D)/2}^{n}, n ℇ ℤ,
where (x_{1},y_{1}) is the least solution of x^{2}-Dy^{2}=4.

We use Stolt's bounds for the fundamental solutions, which are, with small changes, sufficient as well as being necessary conditions. (See *On the Diophantine equation u*^{2}-Dv^{2}=±4N, Archiv för Matematik (1952) 2, nr. 1, 1-23, 2, nr. 10, 251-268.
This is a BCMath version of the BC function `stolt0`.

Note that this method is only useful for small D and N.

Warning: The program may halt prematurely, without an error message, due to running time limits.

If the Stolt upper bound exceeds 10^{6}, the program terminates after calculation of the least solution of Pell's equation.

Taking D=9z^{2}-4 and N=-4z^{2}, the Markoff numbers conjecture is equivalent to the statement that for z ≥ 5, the equation x^{2} - (9z^{2}-4)y^{2} = -4z^{2} has at most one positive solution (x,y) with y < z/√(3z-2). See note.

*Last modified 11th September 2015*

Return to main page