Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Mathematical Functions > Number Theoretic Functions >

CoprimeQ

CoprimeQ[n1, n2]
yields True if n1 and n2 are relatively prime, and yields False otherwise.
CoprimeQ[n1, n2, ...]
yields True if all pairs of the ni are relatively prime, and yields False otherwise.
  • The ni can be Gaussian integers.
8, 9 and 11 are relatively prime:
8, 9 and 11 are relatively prime:
In[1]:=
Click for copyable input
Out[1]=
CoprimeQ works with numbers of any size:
CoprimeQ threads itself element-wise over lists:
Gaussian integers:
Plot pairs of numbers that are relatively prime:
Find the fraction of pairs of the first 100 numbers that are relatively prime:
The result is close to 1/zeta(2):
Find the first 2x2 block of white squares in the array of coprime numbers:
Plot which triples of numbers are relatively prime:
2D slices:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team