Finding primitive solutions of the diophantine equation ax2+bxy+cy2=n, where b2-4ac > 0 and is not a perfect square, n non-zero, gcd(a,b,c)=1

If gcd(a,n)=1, the algorithm finds representatives with least positive y.
(See paper.) The standard method is due to Gauss (See G.B. Mathews Number Theory, page 97 or L.E. Dickson, Introduction to the theory of numbers, pages 74-75.)

E = 1 is verbose.

Enter a:
Enter b:
Enter c: (gcd(a,b,c)=1)
Enter n (non-zero):
Enter E (0 or 1):

Last modified 27th May 2009
Return to main page