Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004
def Euclid(a,b): a1=a b2=b x=ly=0 y=lx=1 while b!=0: q=a//b (a,b)=(b,a%b) (x,lx)=(lx-q*x,x) (y,ly)=(ly-q*y,y) print ('%d * %d + %d * %d= %d' %(a1,lx,b2,ly,a))
Euclid(75,23)
75 * 0 + 23 * 1= 23 75 * 1 + 23 * -3= 6 75 * -3 + 23 * 10= 5 75 * 4 + 23 * -13= 1