Relatively Prime -- From Wolfram MathWorld

Relatively prime plots

Two integers are relatively prime if they share no common positive factors (divisors) except 1. Using the notation (m,n) to denote the greatest common divisor, two integers m and n are relatively prime if (m,n)=1. Relatively prime integers are sometimes also called strangers or coprime and are denoted m_|_n. The plot above plots m and n along the two axes and colors a square black if (m,n)=1 and white otherwise (left figure) and simply colored according to (m,n) (right figure).

Two numbers can be tested to see if they are relatively prime in the Wolfram Language using CoprimeQ[m, n].

Two distinct primes p and q are always relatively prime, (p,q)=1, as are any positive integer powers of distinct primes p and q, (p^m,q^n)=1.

Relative primality is not transitive. For example, (2,3)=1 and (3,4)=1, but (2,4)=2.

The probability that two integers m and n picked at random are relatively prime is

 P((m,n)=1)=[zeta(2)]^(-1)=6/(pi^2)=0.60792... (1)

(OEIS A059956; Cesàro and Sylvester 1883; Lehmer 1900; Sylvester 1909; Nymann 1972; Wells 1986, p. 28; Borwein and Bailey 2003, p. 139; Havil 2003, pp. 40 and 65; Moree 2005), where zeta(z) is the Riemann zeta function. This result is related to the fact that the greatest common divisor of m and n, (m,n)=k, can be interpreted as the number of lattice points in the plane which lie on the straight line connecting the vectors (0,0) and (m,n) (excluding (m,n) itself). In fact, 6/pi^2 is the fractional number of lattice points visible from the origin (Castellanos 1988, pp. 155-156).

Given three integers (k,m,n) chosen at random, the probability that no common factor will divide them all is

 P((k,m,n)=1)=[zeta(3)]^(-1)=0.83190... (2)

(OEIS A088453; Wells 1986, p. 29), where zeta(3) is Apéry's constant (Wells 1986, p. 29). In general, the probability that n random numbers lack a pth power common divisor is [zeta(np)]^(-1) (Cohen 1959, Salamin 1972, Nymann 1975, Schoenfeld 1976, Porubský 1981, Chidambaraswamy and Sitaramachandra Rao 1987, Hafner et al. 1993).

Interestingly, the probability that two Gaussian integers a and b are relatively prime is

 P_(Gaussian)((a,b)=1)=6/(pi^2K)=0.66370... (3)

(OEIS A088454), where K is Catalan's constant (Pegg; Collins and Johnson 1989; Finch 2003, p. 601).

Similarly, the probability that two random Eisenstein integers are relatively prime is

 P_(Eisenstein)((a,b)=1)=6/(pi^2H)=0.77809... (4)

(OEIS A088467), where

 H=sum_(k=0)^infty[1/((3k+1)^2)-1/((3k+2)^2)] (5)

(Finch 2003, p. 601), which can be written analytically as

H=1/9[psi_1(1/3)-psi_1(2/3)] (6)
=0.78130... (7)

(OEIS A086724), where psi_1(z) is the trigamma function

Amazingly, the probabilities for random pairs of integers and Gaussian integers being relatively prime are the same as the asymptotic densities of squarefree integers of these types.

Tag » What Does Relatively Prime Mean