The Prime Conspiracy

Pick two random integers. The probability they share no common factor has no business being what it is.

The Prime Conspiracy

Pick two random integers. Any two. What's the probability they share no common factor?

If you've never seen this before, take a guess. The answer has no business being what it is.

The Setup

Two integers m and n are coprime if gcd(m, n) = 1 — they share no prime factor. So 15 and 28 are coprime (factors 3·5 and 2²·7, nothing in common), but 12 and 18 aren't (both divisible by 6).

The question: if you pick m and n uniformly at random from {1, 2, …, N}, what fraction of pairs are coprime as N → ∞?

Let's think about it prime by prime.

The Sieve

For a specific prime p, what's the probability that p divides both m and n? Well, about 1/p of all integers are divisible by p, and the choices are independent, so the probability p divides both is 1/p².

The probability p does not divide both is 1 − 1/p².

Now here's the key insight: for m and n to be coprime, no prime can divide both. And divisibility by distinct primes is (essentially) independent. So:

P(coprime) = ∏ₚ (1 − 1/p²)

where the product runs over all primes p = 2, 3, 5, 7, 11, …

This is an infinite product over all primes. It should give us some complicated, transcendental mess. And it does — but it's a specific transcendental mess.

Enter Euler

In 1737, Euler proved one of the most beautiful identities in mathematics:

∑_{n=1}^{∞} 1/n² = ∏ₚ 1/(1 − 1/p²)

The left side is the Basel problem: 1 + 1/4 + 1/9 + 1/16 + ⋯ = π²/6.

Euler had solved the Basel problem two years earlier, stunning the mathematical world. The sum of inverse squares, a problem that had defeated the Bernoullis and Leibniz, equaled π²/6. Already strange — what does the geometry of a circle have to do with adding up 1/n²?

But now combine the two results:

π²/6 = ∏ₚ 1/(1 − 1/p²)

Take the reciprocal:

∏ₚ (1 − 1/p²) = 6/π²

And that product on the left is exactly our probability.

P(two random integers are coprime) = 6/π² ≈ 0.6079…

The Shock

Read that again. You pick two random whole numbers. The probability they share no common factor is 6/π².

Pi. The ratio of a circle's circumference to its diameter. Showing up in a problem about divisibility of integers. There are no circles here. No curves, no geometry, no trigonometry. Just whole numbers and their factors.

This is the moment where mathematics stops feeling like a human invention and starts feeling like something we're discovering. Pi isn't a geometric constant that sometimes wanders into number theory — it's a structural constant of reality that geometry happens to encounter first.

Verification

This is the kind of claim that demands empirical confirmation. Let's check it.

from math import gcd

def coprime_probability(N):
    count = sum(1 for a in range(1, N+1) 
                  for b in range(1, N+1) 
                  if gcd(a, b) == 1)
    return count / N**2

# Check convergence
for N in [100, 500, 1000, 5000]:
    p = coprime_probability(N)
    print(f"N = {N:>5}: P(coprime) = {p:.6f}")

# 6/π² ≈ 0.607927...
from math import pi
print(f"\n6/π² = {6/pi**2:.6f}")

Run it and watch the empirical probability march toward 6/π²:

N P(coprime) 6/π²
100 0.6087 0.6079
500 0.6083 0.6079
1000 0.6081 0.6079
5000 0.6080 0.6079

The convergence is steady and undeniable.

The Deeper Pattern

This isn't a one-off. The same Euler product connects to:

  • P(k random integers are mutually coprime) = 1/ζ(k), where ζ is the Riemann zeta function. For k = 2, ζ(2) = π²/6, giving us our result.
  • The expected number of common prime factors of two random integers is ∑ₚ 1/p² ≈ 0.4522, a constant known as the prime zeta function at 2.
  • The probability that a random integer is squarefree (not divisible by any perfect square > 1) is also 6/π². Same constant, completely different question.

The Riemann zeta function — the most studied object in analytic number theory, home of the most famous unsolved problem in mathematics — is sitting underneath a question you could ask a child.

What It Means

There's a conspiracy among the primes. Not the kind you'd expect — not some hidden pattern in their distribution, not some shortcut to finding the next one. It's subtler than that.

The primes organize the integers so thoroughly that when you ask a random question about random numbers, the answer encodes the structure of the primes themselves. And the structure of the primes is entangled with π, with e, with the deepest constants of analysis.

This is what the "Undiscovered Country" is about. Not the headline results — the Riemann Hypothesis, the Twin Prime Conjecture — but the quiet conspiracies hiding in the foundations. The moments where you ask an innocent question and the universe answers in a language you didn't expect it to speak.

Pick two numbers. Check if they share a factor. Do it a billion times.

You'll find π waiting for you in the answer. It was always there.


This is Essay #4 in the "Undiscovered Country" series — dispatches from the frontier of combinatorics and number theory. Essay #1: The Ghost of e⁻² | Essay #2: The Loop | Essay #3: The Divisor Surprise