def euclide(a,b): r=a%b print (a,b,r) while r !=0: a=b; b=r r=a%b print (a,b,r)
sage: euclide(12,5) (12, 5, 2) (5, 2, 1) (2, 1, 0)
1 | initial version | asked 2015-01-29 03:35:55 +0100 Anonymous |
def euclide(a,b): r=a%b print (a,b,r) while r !=0: a=b; b=r r=a%b print (a,b,r)
sage: euclide(12,5) (12, 5, 2) (5, 2, 1) (2, 1, 0)
2 | No.2 Revision |
def euclide(a,b):
r=a%b
print (a,b,r)
while r !=0:
a=b; b=r
r=a%b
print 3 | No.3 Revision |
I'm writing a Sage Function for the Euclid's Algorithm. However when I run it, it doesn't compute any values. Please let me know what is wrong or anyway to help.
def euclide(a,b):
r=a%b
print (a,b,r)
while r !=0:
a=b; b=r
r=a%b
print (a,b,r)
sage: euclide(12,5)
(12, 5, 2)
(5, 2, 1)
(2, 1, 0)