Functions to solve any Diophantine equation.