Diophantine equation in 3 unknowns - Script

This Java Script solves the Diophantine equation ax + by + cz = d in integers.
x + y + z =

Method

 Let p = GCD(a,b), a' = a/p, b' = b/p
 Let u0 and v0 any solution of a'u + b'v = c 
 z0, t0 any solution of cz + pt = d 
 x0, y0 any solution of a'x + b'y = t0 
 The general solution of ax + by + cz = d is : 
 x = x0 + b'k - u0m
 y = y0 - a'k - v0m
 z = z0 + pm with k and m any integer in Z 

Of course GCD(a,b,c) must divide d, which is checked when solving cz + pt = d.

 

Home Arithmetic Geometric Misc Topics Scripts Games Exercices Mail Version Française Previous topic Next topic