GCD
Returns the greatest common divisor of two or more integers. The GCD is the largest integer that divides all numbers without a remainder.
GCD(number1, [number2], ...)Arguments
number1First integernumber2Additional integers(optional)
=GCD(12, 8)4 is the largest number that divides both 12 and 8
=GCD(24, 36, 48)12 divides all three numbers evenly
=GCD(7, 13)7 and 13 are coprime (no common factor other than 1)
- •Useful for simplifying fractions
- •Decimals are truncated to integers before calculation
- •Returns #NUM! if any argument is negative
- •Passing a negative number to GCD, which returns a #NUM! error since the greatest common divisor is only defined for non-negative integers
- •Passing a non-integer number expecting an error - GCD actually truncates decimal values first, so GCD(4.9,6) calculates the GCD of 4 and 6
- •Confusing GCD with LCM - GCD finds the largest number that divides evenly into all the inputs, while LCM finds the smallest number that all the inputs divide evenly into, and the two produce very different results for the same inputs
LCMCalculates the least common multiple, essentially the inverse relationship to GCD's greatest common divisor.MODOften used alongside GCD when implementing algorithms that rely on divisibility, like simplifying fractions.QUOTIENTCan be combined with GCD to simplify a fraction by dividing both numerator and denominator by their greatest common divisor.Why does GCD return a #NUM! error?
One of the numbers supplied is negative - GCD only works with non-negative integers.
What's the difference between GCD and LCM?
GCD finds the largest number that evenly divides all the inputs, while LCM finds the smallest number that all the inputs evenly divide into - they answer opposite questions about the same set of numbers.
Can GCD handle decimal inputs?
It truncates any decimal portion first rather than raising an error, so GCD(4.9,6) is calculated as GCD(4,6).
Need to translate a formula using GCD?
Use our translator to convert your complete formula
