Post Reply 
(38G) IEGCD or Bézout
03-15-2015, 09:54 AM (This post was last modified: 06-15-2017 01:56 PM by Gene.)
Post: #1
(38G) IEGCD or Bézout
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)):
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)