Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>
I wrote some algorithm for that long time (at least 10 years) ago in
Delphi. It was pretty short.
I think I implemented something like this:
http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
imho it should not be that difficult to implement this again in sympy,
at least for some simple cases, like the one above.
Ondrej
In [1]: gcdex(12, 32)
Out[1]: (3, -1, 4)
But that is only useful for solving equations of the form a*x + b*x == c. I guess for this specific problem, you could see if the solutions to 4*x + 1*y == 17 are perfect squares and take +/- sqrt() of them. Also look at the diophantine version of gcdex, which I have implemented buried in my integration branch (see http://github.com/asmeurer/sympy/blob/integration/sympy/integrals/risch.py#L50; all it essentially does more than gcdex() is multiply through by c/gcd(a, b)).
We also have the Chinese Remainder Theorem buried in galiostools.py, and it shouldn't be too hard to write a high-level algorithm for it.
Solving Diophantine equations in general is undecidable (Hilbert's tenth problem), but clearly there are heuristics (I don't know what they are, though, other than these).
Aaron Meurer
See also section 1.3 of this book [0] (page 13 in particular).
Aaron Meurer
P.S. I was thinking that we needed to implement the Sieve of Atkin instead of Eratosthenes just the other day.