(38G) IEGCD or Bézout - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (38G) IEGCD or Bézout (/thread-3381.html) |
(38G) IEGCD or Bézout - Gerald H - 03-15-2015 09:54 AM For input {A,B} in HOME the programme returns {x,y,z} in Ans, where x*A+y*B=GCD(A,B)=z. Ans►L0: Ans(1)►X: L0(2)►I: (X,1)►Z0: (I,0)►Z1: WHILE RE(Z1) REPEAT Z1►Z3: Z0-INT(RE(Z0)/RE(Z1))*Z1►Z1: Z3►Z0: END: IM(Z0): {Ans,ROUND((RE(Z0)-X*Ans)/I,0),RE(Z0)}*SIGN(RE(Z0)): |