Python | sympy.lcm () method

Python Methods and Functions

Using the sympy.lcm() method, we can find the least common multiple of two numbers, which is passed as a parameter to sympy.lcm () .

Syntax: sympy.lcm (var1, var2)
Return: Return value of least common multiple.

Example # 1:
In this example, we can see that with sympy.lcm () we can find the smallest common multiple of any two numbers that are passed as parameters.

# import sympy

from sympy import *

 
# Using the sympy.lcm () method

gfg = lcm ( 61 , 24 )

  

print (gfg)

Output:

1464

Example # 2:

# import sympy

from sympy import *

 
# Using the sympy.lcm () method

gfg = lcm ( 17 , 16 )

  

print (gfg)

Output:

272





Tutorials