Android Utililty Methods Int LCM

List of utility methods to do Int LCM

Description

The list of methods to do Int LCM are organized into topic(s).

Method

intlcm(int a, int b)

Returns the least common multiple of the absolute value of two numbers, using the formula lcm(a,b) = (a / gcd(a,b)) * b .

if (a == 0 || b == 0) {
    return 0;
int lcm = FastMath.abs(ArithmeticUtils
        .mulAndCheck(a / gcd(a, b), b));
if (lcm == Integer.MIN_VALUE) {
    throw new MathArithmeticException(
            LocalizedFormats.LCM_OVERFLOW_32_BITS, a, b);
...