GCD()

Syntax. GCD(number1,number2,...)

Definition. This function returns the greatest common divisor of two or more integers.

Arguments

  • number1 (required) and number2 (optional) The minimum number of values is 1, and the maximum is 255 (29 in Excel 2003 and earlier versions). At least one value is required, but a second value makes sense so that a common divisor can be found.

Background. The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.

Excel calculates the greatest common divisor based on integers. Decimal places are truncated. If one of the arguments isn’t a numeric expression, the GCD() function returns the #VALUE! error. If one of the arguments is smaller than zero, the function returns the #NUM! error.

The greatest common divisor can be calculated in two ways: with prime factorization or with the Euclidean division algorithm.

Prime Factorization. The greatest common divisor is the product of the common prime factor of all numbers. The numbers are used only once as factors. The greatest common divisor can be calculated by factorizing m and n.

Here is an example:

m = 36 = 22 • 32

n = 120 = 23 • 3 • 5

The factors found in both numbers are multiplied.

Euclidean Division Algorithm. This method can be used only to calculate the greatest common divisor of two numbers. Divide the larger number by the smaller number. Then divide the divisor by the remainder. Repeat this operation until there is no remainder. The last divisor is the greatest common divisor of the two numbers.

Note

From the greatest common divisor as well as the product of m and n, you can calculate the least common denominator:

image with no caption

Example. The floor of a 20-foot by 10-foot room has to be evenly covered with the largest possible tiles. What is the side length of the tiles?

=GCD(20,10) returns 10; the tiles should be 10 feet long.

See Also

LCM()

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.32.222