The math.lcm()
function is used to calculate the least common multiple of two or more numbers.
math.lcm(*args)
copy
Where, args
represents the arbitrary integer arguments whose LCM is to be calculated. The number of the arguments should be greater than or equal to 2.
The LCM of given integers is the smallest number that is a multiple of all the numbers provided as arguments. For example, the LCM of 4 and 5 is 20 since 20 is the smallest number that is a multiple of both 4 and 5.
The arguments passed to the math.lcm()
function should be strictly integers. Otherwise, a TypeError
is raised.