python/모듈

[Python] 최소공배수, 최대공약수

wjwkddyd221001 2023. 2. 10. 20:02

최소공배수

  • lcm, least common multiple
import math

math.lcm(a, b)

 

최대공약수

  • gcd, greatest common divisor
import math

math.gcd(a, b)