Library · Geometric Probability · Chapter 56

Three coprime integers

Revised Report an error

Problem 56.1

Let a,b,ca, b, c be three integers chosen independently and uniformly from {1,2,…,N}\{1, 2, \ldots, N\}. As N→∞N \to \infty, what is the probability that gcd⁡(a,b,c)=1\gcd(a, b, c) = 1?

Solution. Repeat the Euler-product argument of Chapter 52. For each prime pp, let Ap={p∣a  and  p∣b  and  p∣c}A_p = \{ p \mid a \;\text{and}\; p \mid b \;\text{and}\; p \mid c \}. Since each of a,b,ca, b, c is divisible by pp with probability 1/p+O(1/N)1/p + O(1/N), and the three divisibility events are independent, P(Ap)→1p3as N→∞.\mathbb{P}(A_p) \to \frac{1}{p^3} \quad \text{as } N \to \infty. The triple (a,b,c)(a, b, c) has gcd⁡=1\gcd = 1 iff ⋂pApc\bigcap_p A_p^{c}, and the events {Ap}\{A_p\} across distinct primes are essentially independent in the large-NN limit (joint divisibility factorises by the Chinese remainder theorem). Hence P(gcd⁡=1)→∏p(1−1p3).\mathbb{P}(\gcd = 1) \to \prod_p \left(1 - \frac{1}{p^3}\right).

To justify passing from finitely many primes to all primes, first retain only primes p≤Mp\leq M. Their joint divisibility probabilities converge as stated. Uniformly in NN, the probability that a prime p>Mp>M divides all 3 sampled integers is at most p−3p^{-3}, so the union bound makes the omitted probability at most ∑m>Mm−3\sum_{m>M}m^{-3}, which tends to 00 as M→∞M\to\infty.

By the Euler product for the Riemann zeta function, ∏p(1−p−s)−1=ζ(s)\prod_p (1 - p^{-s})^{-1} = \zeta(s), so ∏p(1−1p3)=1ζ(3).\prod_p \left(1 - \frac{1}{p^3}\right) = \frac{1}{\zeta(3)}. Therefore P(gcd⁡(a,b,c)=1)→1ζ(3)≈0.8319.■\boxed{\mathbb{P}(\gcd(a, b, c) = 1) \to \frac{1}{\zeta(3)} \approx 0.8319.} \qedhere

The constant ζ(3)=1.20205…\zeta(3) = 1.20205\ldots is called Apéry’s constant; Roger Apéry proved in 1978 that it is irrational, a result that surprised number theorists because the analogous ζ(2)=π2/6\zeta(2) = \pi^2/6 is a transcendental number by Lindemann’s theorem, but ζ(3)\zeta(3) has no known closed form in terms of π\pi or other classical constants. So unlike the two-variable case of Chapter 52 (where the answer is 6/π26/\pi^2), the three-variable coprime probability is a constant with no known simpler form.

The general formula, for kk integers uniformly distributed, is 1/ζ(k)1/\zeta(k); the limit as k→∞k \to \infty is 11 (all large-kk-tuples are asymptotically coprime, since the probability that some fixed prime divides all of them decays as p−kp^{-k}).

import numpy as np
Nmax, N = 10**4, 10**6
a, b, c = np.random.randint(1, Nmax+1, (3, N))
g = np.gcd(np.gcd(a, b), c)
p = (g == 1).mean()
zeta3 = 1.2020569031595942  # Apery's constant
print(f"sim: {p:.5f}   exact: {1/zeta3:.5f}")
# sim: 0.83191   exact: 0.83191
Report an error on this page

Reports are stored by Netlify. See the privacy note.