Every whole number (except 1) can be factorized in one and only one way into a product of prime numbers. For example:
$$\displaystyle \begin{aligned} 21 &= 3\times 7 \\ 34 &= 2\times 17 \\ 35 &= 5\times 7 \end{aligned} $$
By looking at the factorizations one can easily tell when two numbers share a common factor, or when they don’t. What is the probability that two randomly chosen whole numbers do not share any common factors?
Let $p_n$ be the $n$-th prime number. $p_n$ of course is a factor of $1/p_n$-th of all whole numbers (i.e. $5$ divides one fifth of all numbers, $7$ divides one seventh of them, and so on). So the probability that $p_n$ divides both of two randomly and independently selected whole numbers $a$ and $b$ is:
$$\displaystyle P(p_n | a \text{ and } p_n | b) = \left( \frac{1}{p_n} \right)^2 $$
So the probability that $p_n$ is not a common factor (i.e. does not divide both) of $a$ and $b$ is just:
$$\displaystyle P(p_n \text{ is not a common factor}) = 1 – \frac{1}{p_n^2} $$
Then the probability that no prime number is a common factor is the product of the above probability over all primes:
$$\displaystyle Q = P(\text{no common factors}) = \prod_{k=1}^\infty \left(1 – \frac{1}{p_k^2} \right) $$
Now we do some rewriting of $Q$:
$$\displaystyle \begin{aligned} Q &= \frac{1}{\prod_{k=1}^\infty \frac{1}{1-\frac{1}{p_k^2}}} \\ &= \frac{1}{\prod_{k=1}^\infty \left( 1 + \frac{1}{p_k^2} + \frac{1}{p_k^4} + \frac{1}{p_k^6} + \cdots \right) }\end{aligned}$$
Here we have rewritten the denominator as a product of geometric series. To demonstrate more clearly what that product looks like, let’s write out the factors produced by the first few prime numbers:
$$\displaystyle \begin{aligned} \frac{1}{Q} &= \left( 1 + \frac{1}{2^2} + \frac{1}{2^4} + \frac{1}{2^6} + \cdots \right) \\ &\times \left( 1 + \frac{1}{3^2} + \frac{1}{3^4} + \frac{1}{3^6} + \cdots \right) \\ &\times \left( 1 + \frac{1}{5^2} + \frac{1}{5^4} + \frac{1}{5^6} + \cdots \right) \\ &\times \left( 1 + \frac{1}{7^2} + \frac{1}{7^4} + \frac{1}{7^6} + \cdots \right) \\ &\vdots \end{aligned} $$
Despite the fact that each group in parentheses contains infinitely many terms, we can still expand the product by adding together every possible product comprised of one individual term from each series (this rewriting will not change the result because the geometric series involved are absolutely convergent). For example, we can start with the product of all the first terms and then add the product of the second term from the first series and the first terms of all the others:
$$\displaystyle \begin{aligned} \frac{1}{Q} &= (1\times 1\times 1\times \cdots…) \\ &+ (\frac{1}{2^2}\times 1 \times 1 \times \cdots) \\ &+\vdots \end{aligned}$$
The key here is that each term in parentheses here is the reciprocal of a unique number that is the product of squares of primes. It is unique because there is only one way to write each number as a product of primes. And since every product of squared primes, aka squared product of primes, aka squared whole number, will appear in the above sum at some point, we can say that:
$$\displaystyle \frac{1}{Q} = \sum_{m=1}^\infty \frac{1}{m^2} = \frac{\pi^2}{6}$$
The fact that this sum is equal to $\pi^2/6$ is a famous fact which will be the subject of a future post. Anyway, we have now shown that the probability that two randomly chosen whole numbers have no common factors is:
$$Q = \frac{1}{\pi^2/6} = \frac{6}{\pi^2} = 0.607927101854026…$$