Two positive integers are picked randomly. What is the probability that they are relatively prime?
Give your answer to three decimal places.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let the two numbers be a and b , and fix a prime number p . Since p divides any positive integer with probability p 1 , the probability that both a and b is divisible by p is ( p 1 ) 2 . Therefore the probability that their greatest common divisor is not divisible by p is 1 − p 2 1 .
Note that a and b are relatively prime exactly when p ∤ g cd ( a , b ) for every positive prime p .
Therefore the probability P of a and b being relative primes can be expressed as
P = p ∏ ( 1 − p 2 1 )
where the value of p runs through all positive primes.
Upon taking the reciprocal of P it can be observed that each term of the product equals to the value of an infinite geometric sum with first term 1 and quotient p 2 1 . (Remark that 1 − x 1 = 1 + x + x 2 + x 3 + … whenever ∣ x ∣ < 1 ):
P 1 = p ∏ 1 − p 2 1 1 = p ∏ ( 1 + p 2 1 + p 4 1 + p 6 1 + … )
Notice that if we expand the product above we get to the infinite sum 1 + 2 2 1 + 3 2 1 + 4 2 1 + … as our result, which was proven by Euler to be equal to 6 π 2 . Therefore P = π 2 6 ≈ 0 . 6 0 8 .