Lcm

lcm(a, b) = a * b / gcd(a, b)
lcm(a, b, c) = lcm(lcm(a, b), c)

std::lcm

In STL, there is a built-in std::lcm

Last updated