Python | sympy.ilcm () method

Python Methods and Functions

Using the sympy.ilcm() method, we can find the least common multiple of two non-negative integers, which is passed as a parameter to sympy.ilcm () .

Syntax: sympy.ilcm (var1, var2)
Return: Return value of least common multiple of two nonnegative integers.

Example # 1:
In this example, we can see that using sympy.ilcm () we can find the smallest common multiple of any two non-negative integers passed as parameters.

# import sympy

from sympy import *

 
# Using the sympy.ilcm () method

gfg = ilcm ( 2 , 3 )

 

print (gfg)

Output:

 6 

Example # 2:

# import sympy

from sympy import *

 
# Using the sympy.ilcm () method

gfg = i lcm ( 7 , 6 )

  

print (gfg)

Output:

 42 




Get Solution for free from DataCamp guru