gives the greatest common divisor of the ni.
- GCD is also known as the greatest common factor or highest common factor.
- Integer mathematical function, suitable for both symbolic and numerical manipulation.
- GCD[n1,n2,…] is the largest positive integer that divides each of the integers n1,n2,….
- For rational numbers ri, GCD[r1,r2,…] gives the greatest rational number r for which all the ri/r are integers.
- GCD works over Gaussian integers.
Examplesopen allclose all
Basic Examples (2)
Numerical Manipulation (7)
Symbolic Manipulation (4)
Basic Applications (3)
Compute GCD for positive integers:
Number Theory (8)
Simplify expressions containing GCD:
Properties & Relations (8)
GCD for prime numbers is :
GCD for prime power representation .
ExtendedGCD gives integers x and y that satisfy for some integers a and b:
Use CoprimeQ to check for trivial GCDs:
GCD is commutative :
GCD is associative :
GCD is distributive :
Possible Issues (3)
GCD sorts its arguments:
Wolfram Research (1988), GCD, Wolfram Language function, https://reference.wolfram.com/language/ref/GCD.html (updated 1999).
Wolfram Language. 1988. "GCD." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1999. https://reference.wolfram.com/language/ref/GCD.html.
Wolfram Language. (1988). GCD. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GCD.html