This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

GCD

GCD
gives the greatest common divisor of the .
  • 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 , GCD gives the greatest rational number r for which all the are integers.
  • GCD automatically threads over lists.
Greatest common divisor of three numbers:
Plot the GCD for a number with 1000:
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]=
GCD threads element-wise over lists:
Use with rational arguments:
Use with Gaussian integers:
TraditionalForm formatting:
Find the fraction of pairs of the first 100 numbers that are relatively prime:
The result is close to :
Plot the means of the GCDs for successive "balls" of numbers:
Conditions for solvability of a linear congruence equation:
GCDs of Fibonacci numbers:
Use CoprimeQ to check for trivial GCDs:
Compute GCD from Floor:
Use in sums:
Simplify expressions containing GCD:
Reduce inequalities involving GCD:
GCD is very fast, even for many very large integers:
Signs are discarded:
The arguments must be explicit integers:
GCD sorts its arguments:
Plot the argument of the Fourier transform of the GCDs:
Form GCDs of 1 with rational numbers:
A GCD property of Fibonacci numbers:
New in 1 | Last modified in 4