# What is the probability of being prime?

Given some arbitrarily large $a$, what is the probability that this number is a prime number?

My attempt involves seeing that for $a$ to be prime, then it must not have a factor $N$ in the following range:

$$2\le N\le\sqrt{a}$$

Which helps make the problem somewhat easier.

Then, I noted all the possible prime numbers in the range for needed factors.

I will call them $p_1,p_2,p_3,\dots p_i$.

I think, if I am correct, that the probability that $a$ will be prime is as follows:

$$P_a=\frac1{\Pi_{v=1}^ip_v}$$

Of course, this requires knowledge on all of the primes in the given range, which I want to avoid.

So my questions are, is my probability correct? And is there another formula that finds the probability of a number $a$ being prime without the need of anything other than the given number $a$?

Note that the probability of a number being prime is not the same as the question whether or not a number is prime.

Ok, according to the comments, I should probably clarify things. If this helps, I wish to find the probability that a given number is prime, and I want to find the individual probability of each natural number in terms of itself.

That is, the probability $P_a$ that $a$ will be prime is given as:

$$P_a=f(a)$$

Where we apply some operation to find the probability that $a$ is prime.

To clarify what I mean by probability of a number being prime, I mean that given a number prime, how probable is it to be prime? (sorry for confusions).

For example, can we agree that $10$ is more likely to be prime than $100$? It is apparent that numbers that are smaller are more often prime numbers than large numbers.

So, it might be interesting to notice that:

$$P_{10}>P_{100}>P_{100+n}$$

Still confused? Or perhaps this question is just unanswerable.

So I ask a second question, one that may be more clear.

In a given range, $a\le N\le b$, how many prime numbers $N$ are expected to exist in that range? I think that this second question is clearer, but if it still raises concerns, do inform me.

• What probability distribution are you using on the positive integers? – Chappers Jan 28 '16 at 0:40
• In order to discuss probability, you must have a probability distribution. For example, what is the probability of picking a $7$? – user223391 Jan 28 '16 at 0:45
• There are infinitely many natural numbers, which means that you can't just assign each one the same positive probability of being chosen. So you have to specify the probability with which each one may be picked. An obvious one is to give $n$ a chance proportional to $n^{-s}$ for some $s>1$, which will obviously take you to the Riemann zeta-function. – Chappers Jan 28 '16 at 0:48
• It's not clear to me what is meant by "the probability that a given number is prime". A given number is either prime or not. I suggest you give some thought to what you really want to know. For example, a sensible question (perhaps not the question you want) would be: "a number is chosen uniformly and at random from all $n$-digit numbers: what, in terms of $n$, is the probability that it is prime?" – David Jan 28 '16 at 0:53
• @user41728: No. The problem is that the question would not even arise if the asker had understood probability properly. That is what all the commenters are trying to get at. To give an analogy, it is ill-defined to ask "What is the probability that a random integer is more than $100$?". The answer is "What is random???". – user21820 Jan 30 '16 at 3:44

The proportion of the first $N$ positive integers which are prime goes to $0$ as $N \to \infty$. This is because the proportion of the first $N$ positive integers which are not divisible by the first $k$ primes $p_1, p_2, \dots p_k$ is, as $N$ gets large,

$$\prod_{i=1}^k \left( 1 - \frac{1}{p_i} \right)$$

and this product goes to $0$ as $k \to \infty$. This is a nice exercise.

So in some sense the probability is $0$ (more precisely, the natural density; this shares some but not all of the features of a probability measure).

But in a more useful sense, according to the prime number theorem, the probability that a positive integer about as large as $N$ is prime is about $\frac{1}{\ln N}$.

See the Prime Number Theorem:

• This only gives the probability that some number in the range up to $x$ is prime. Calculating the probability for $x$ itself is a little more involved is it not? – user334732 Oct 10 '18 at 7:25