Java Utililty Methods BigInteger LCM

List of utility methods to do BigInteger LCM

Description

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

Method

BigIntegerlcm(BigInteger a, BigInteger b)
Least common multiple.
http://en.wikipedia.org/wiki/Least_common_multiple
lcm( 6, 9 ) = 18
lcm( 4, 9 ) = 36
lcm( 0, 9 ) = 0
lcm( 0, 0 ) = 0
if (a.signum() == 0 || b.signum() == 0)
    return BigInteger.ZERO;
return a.divide(a.gcd(b)).multiply(b).abs();
BigIntegerlcm(BigInteger a, BigInteger b)
lcm
return a.multiply(b).divide(gcd(a, b));
BigIntegerlcm(BigInteger... nums)
lcm
return lcm(Arrays.asList(nums));
BigIntegerlcm(BigInteger... values)
Calculates the least common multiple of the specified BigInteger big integer numbers.
if (values.length == 0)
    return BigInteger.ONE;
BigInteger lcm = values[0];
for (int i = 1; i < values.length; i++) {
    if (values[i].signum() != 0) {
        final BigInteger gcd = lcm.gcd(values[i]);
        if (gcd.equals(BigInteger.ONE)) {
            lcm = lcm.multiply(values[i]);
...