Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168744
Image: ubuntu2004
def exGCD (m, n): if n==0: d = m x = 1 y = 0 return(d,x,y) else: x2=1 x1=0 y2=0 y1=1 while n>0: q = m//n r=m-q*n x=x2-q*x1 y=y2-q*y1 m=n n=r x2=x1 x1=x y2=y1 y1=y d=m x=x2 y=y2 return(d,x,y) exGCD (3, 7)
(1, -2, 1)