GCD

GCD[n1,n2,]

gives the greatest common divisor of the ni.

Details

  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • GCD works with ordinary and Gaussian integers.
  • GCD works not only with integers but also rational numbers, both real and complex.
  • For rational numbers ri, GCD[r1,r2,] gives the greatest rational number r for which all the ri/r are integers.
  • GCD has attributes Flat and Orderless.
  • GCD automatically threads over lists.

Examples

open allclose all

Basic Examples  (2)

Greatest common divisor of three numbers:

In[1]:=
Click for copyable input
Out[1]=

Plot the GCD for a number with 1000:

In[1]:=
Click for copyable input
Out[1]=

Scope  (4)

Applications  (6)

Properties & Relations  (9)

Possible Issues  (3)

Neat Examples  (3)

See Also

CoprimeQ  PrimeQ  PolynomialGCD  Divisible  Rational  LCM  ExtendedGCD  ChineseRemainder  Cancel

Tutorials

Introduced in 1988
(1.0)
| Updated in 1999
(4.0)