# XSOLVE -- solve ax + by = c # # xsolve(a,b,c) returns a solution of ax + by = c. # # assume that the gcd of a and b divides c, # where a, b, c are integers. # xsolve := proc(a,b,c) local r, q, s, u, x; r := a mod b; if r = 0 then RETURN( [0,c/b] ); else s := xsolve( b, r, c ); u := s[1]; x := s[2]; q := (a-r)/b; RETURN( [ x, u - q*x ] ); fi; end: # jac, 6/11/2001