Search code examples
greatest-common-divisorlcm

GCD and LCM relation


The following relation works only for two (3, 12) numbers, it fails to produce the right answer when used for three numbers (3,12,10) . Just wondering if is it my understanding or it is just for two numbers and for me same is true for Euclid algorithm as well.

LCM(a, b) = (a x b) / GCD(a,b) or GCD(a,b) = (a x b) / LCM(a, b) 

Solution

  • The analogous formulas to

    LCM(a, b) = (a x b) / GCD(a,b) or GCD(a,b) = (a x b) / LCM(a, b) 
    

    with three variables are simply not valid, as your example with (3, 12, 10) shows readily.

    The product of these three numbers is 360. The GCD is 1. The LCM is 60.