Euclidean Algorithm This algorithm finds GCD by performing repeated division starting from the two numbers we want

to find the GCD of until we get a remainder of 0. For our example, 24 and 60, below are the steps to find GCD using Euclid's algorithm. • Divide the larger number by the small one. In this case we divide 60 by 24 to get a quotient of 2 and remainder of 12. • Next we divide the smaller number (i.e. 24) by the remainder from the last division (i.e. 12). So 24 divide by 12, we get a quotient of 2 and remainder of 0. • Since we already get a remainder of zero, the last number that we used to divide is the GCD, i.e 12. Let's look at another example, find GCD of 40 and 64. • • • • 64 ÷ 40 = 1 with a remainder of 24 40 ÷ 24 = 1 with a remainder of 16 24 ÷ 16 = 1 with a remainder of 8 16 ÷ 8 = 2 with a remainder of 0. We stop here since we've already got a remainder of 0. The last number we used to divide is 8 so the GCD of 40 and 64 is 8

If we know the greatest common divisor (GCD) of integers LCM using the following formula.

a and b, we can calculate the

LCM(a,b) =

a×b GCD(a,b)

Sign up to vote on this title
UsefulNot useful