Finding the fundamental solutions of the diophantine equation ax2+bxy+cy2=n, where a > 0, b2-4ac > 0 and is not a perfect square, n non-zero


We use completion of the square and reduce the equation to X2 – d Y2 = 4an, where X = 2ax + y and Y = y and then solve this equation and obtain its Stolt fundamental solutions. It is only a short step to produce the fundamental solutions of the diophantine equation ax2 + bxy +cy2 = n. See Arkiv för Matematik, Vol 3 (1957), no. 4, 381-390.

We also give formulae for the equivalence class of solutions corresponding to each fundamental solution.

This program has wider applicability than http://www.numbertheory.org/php/stolt_fundamental.html, as the latter is slow when the bounds become large.

This program is a BCMath version of a BC program.

See Note.

Enter a:
Enter b:
Enter c:
Enter n (non-zero):

Last modified 3rd August 2021
Return to main page