6

"It's well known that there are infinitely many prime numbers, but they become rare, even by the time you get to the 100s," Ono explains. "In fact, out of the first 100,000 numbers, only 9,592 are prime numbers, or roughly 9.5 percent. And they rapidly become rarer from there. The probability of picking a number at random and having it be prime is zero. It almost never happens."

--Source: phys.org

I feel really skeptical about the statement in bold above. I think the probability tends to approach zero but can never be zero. Please explain how the probability is being calculated mathematically?

manav m-n
  • 209

5 Answers5

17

The sentence "The probability of picking a number at random and having it be prime is zero." is, mathematically speaking, either very sloppy or plain wrong (depending on who you ask) and, if you ask me, is a clear demonstration of why there's always a bit of tension between mathematicians and physicists. We call them sloppy, they call us hair splitters.

The correct sentence would be this:

If $p_n$ is the probability of picking a prime when (uniformly) selecting a random number from $1$ to $n$, then $\lim_{n\to\infty} p_n = 0$.

This statement follows directly from the prime number theorem. That theorem tells us that the if $P_n$ is the number of primes smaller than or equal to $n$, then $$\lim_{n\to\infty}\frac{P_n}{\frac{n}{\log n}} = 1.$$ Clearly, we have $p_n=\frac{P_n}{n}$, which means that $$\lim_{n\to\infty} p_n=\lim_{n\to\infty}\frac{P_n}{n} = \lim_{n\to\infty}\left(\frac{P_n}{\frac{n}{\log n}}\cdot\frac{1}{\log n}\right) = \lim_{n\to\infty}\frac{P_n}{\frac{n}{\log n}} \cdot\lim_{n\to\infty}\frac{1}{\log n} = 1\cdot 0=0$$

This also tells you that $p_n\approx \frac{1}{\log n}$ for large values of $n$, so you also know the speed at which $p_n$ converges to $0$ (rather slowly, in fact).


(*) The statement is wrong or sloppy because of a simple reason: there is a lot left out in the statement "pick a random number". What's the distribution? Uniform? There is no uniform distribution over all integers! OK, which distribution are we talking about then? Because surely, there exist probability distributions over $\mathbb N$ with a nonzero probability of picking a random number. For example, picking a random number by throwing a 6 sided die has a $0.5$ chance of picking a prime number.

5xum
  • 123,496
  • 6
  • 128
  • 204
  • +1 Excellent answer! – drhab May 22 '19 at 07:53
  • 2
    To stick up for physicists a little, what else could be meant by "the probability of picking a number at random and having it be prime is zero?" – Charles Hudgins May 22 '19 at 07:56
  • 3
    @CharlesHudgins I'm just saying that "picking a random number" is an ill-formed statement without telling us the distribution. – 5xum May 22 '19 at 07:58
  • There is an '=' missing in 'clearly we have $p_n = \frac{P_n}{n}$, but edits need to be at least 6 characters long, so maybe you can edit it in yourself... – Vincent May 22 '19 at 07:59
  • Good answer btw! – Vincent May 22 '19 at 07:59
  • 7
    it obviously meant rolling a dice with faces labelled 4,12,15,21,22,25 – mercio May 22 '19 at 07:59
  • @CharlesHudgins: use finitely additive probability. Then the set of primes can carry any probability you like. – user10354138 May 22 '19 at 08:02
  • Sure, but I think when most people think of probability on the naturals, they think of a limit of uniform distributions. – Charles Hudgins May 22 '19 at 08:04
  • @CharlesHudgins And when most people think of functions, they think of continuous functions. That doesn't make the statement "all functions are continuous" any less wrong. – 5xum May 22 '19 at 08:06
  • 1
    @CharlesHudgins We could "pick a random number" as follows. We pick $n>0$ with probability $1/2^n$. That IS a well defined distribution (unlike just saying "pick a random positive integer"). Observe that with this distribution the probability of picking a prime number is strictly positive (larger than $1/2^2+1/2^3=3/8$ actually). It doesn't tend to anything. To get any kind of "tending" you need a sequence of probability distributions, and that is exactly what 5xum is explaining. – Jyrki Lahtonen May 22 '19 at 08:45
  • FYI: the person being quoted is a mathematician, not a physicist, and is a world expert on the distribution of primes. And he's writing for a non-mathematical audience. – Mathmo123 May 22 '19 at 08:51
  • 1
    @Mathmo123 Sure, the person being quoted. But not the person who is writing. The man was either sloppily quoted or quoted out of context, or was sloppy in saying what he said. I still think it, as written, is sloppy, world expert or not. – 5xum May 22 '19 at 08:54
  • @5xum How would you explain this fact to a non-mathematician in an exciting way? In any case, your physics-bashing was misplaced. – Mathmo123 May 22 '19 at 08:57
  • 1
    @Mathmo123 I was not bashing physicists. I explicitly said "We call them sloppy, they call us hair splitters." which clearly states the opinion one group has to the other. Both opinions are grounded in some truth, and some exaggeration. Also, I would explain this fact by saying something like "primes get rarer and rarer as we move along the number axis" or something like that. Or, the quote to me is just fine up to the final sentence. After "9.5 percent" in the quote, simply conclude with "and the percentage tends to $0$ if you increase that $100,000$ even further. – 5xum May 22 '19 at 09:03
  • 2
    While complaining about the quote leaving out the distribution you managed to do it as well in the "correct" sentence. – KarelPeeters May 22 '19 at 09:49
  • Sorry everyone. Didn't really mean to start an argument. Was just trying to defend imprecision in math communication. Mathematicians often speak this loosely when speaking with each other because the meaning is clear from context. – Charles Hudgins May 22 '19 at 17:35
4

From the Prime number theorem one can interpret as saying that if you pick a random integer of size about n, then the probability that it is prime is about $\frac{1}{\ln n}$.

If for one second, you relax the size about n condition, then the answer depends on what you mean by "picking an integer randomly."

The problem is that there is no way to pick an integer uniformly at random, which precisely means that if every integer has the same probability of being picked then that probability has to be zero, there is no probability distribution on the positive integers that assigns equal weight to every integer.

If you were to let $S\subseteq \mathbb{N}$ be a set of positive integers, and for every positive integer $n$, let $S_n$ be the set of all $k\in S$ such that $k\le n$. Let $|S_n|$ be the number of elements in $S_n$. Then $$\lim_{n\to\infty} \frac{|S_n|}{n},$$ if it exists, can be viewed as a measure of how large $S$ is. The measure for how large the primes is $0$.

2

The probability of picking a random positive integer and is prime is defined as $$ \lim_{n\to\infty}\frac{1}{n}|\{k : 1\le k\le n\,\,\,\&\,\,\,\text{$k$ prime}\}| $$ where $|A|$ is the number of elements of the set $A$ (i.e., its cardinal number.)

Prime Number Theorem implies that the above limit is equal to zero.

1

If $N\in\mathbb N$, then, if you pick a number at random in $\{1,2,\ldots,N\}$ (assuming that all numbers have the same probability of being chosen), then the probability that that number is prime is about $\frac1{\log N}$ (this is the prime number theorem). Therefore, the limit as $N$ goes to infinity of that probability is $0$.

1

Layman's explanation. You are walking up the number line. If you meet a new prime number, you increase the count primes by just 1. But you can multiply this new prime number with all the previously encountered primes or composites once, twice ... or infinitely many times to create infinitely many new composites i.e. finding 1 new prime results in infinitely many new composites somewhere up in the number line so if you stop your walk randomly at a number, you are infinitely times more likely to be standing on a composite than on a prime.