Finding the fundamental primitive solutions of the diophantine equation ax2+bxy+cy2=n, where d=b2-4ac > 0 and is not a perfect square and (√d)/2 > |n|.

The algorithm is sketched in a paper by Keith Matthews, Anitha Srinivasan and John Robertson and is a BCMath version of a BC program.
E = 1 is verbose.

Enter a:
Enter b:
Enter c: (gcd(a,b,c)=1)
Enter n (0 < |n| < (√d)/2):
Enter E (0 or 1):

Last modified 2nd November 2017
Return to main page