论lcm与gcd

 

a = 111
b = 321
from gmpy2 import lcm ,  gcd 
gcd_res = gcd(a,b)

lcm_res = lcm(a,b)

#gcd_res = x1*a
x1 = a/gcd_res
#gcd_res = y1*b
y1 = b/gcd_res

#lcm_res = x2*a
x2 = lcm_res/a
#lcm_res = y2*b
y2 = lcm_res/b
print 'x1 = ',x1
print 'y1 = ',y1
print 'x2 = ',x2
print 'y2 = ',y2

  

 

 

 

posted @ 2020-04-30 16:15  S4tan  阅读(148)  评论(0编辑  收藏  举报