59

Wikipedia says that the largest known prime number is $2^{43,112,609}-1$ and it has 12,978,189 digits. I keep running into this question/answer over and over, but I haven't been able to find how many known prime numbers exist. The website primes.utm.edu allows downloading of the first 50,000,000 known primes so I know there are at least that many; I'm not expecting to find a list of all known primes, but is there any information on how many there are known?

edit Relevant video from Khan Academy: Prime Number Theorem: the density of primes

  • 26
    Luis Silvestre has a list of all prime numbers. It can be browsed but not downloaded. –  Jan 08 '13 at 13:21
  • 3
    $\infty$ perhaps? – Nathaniel Bubis Jan 08 '13 at 13:27
  • 8
    @PavelM: No he hasn't, even if he claims so. And this is not what I call browsing (can I have the last page please?). – Marc van Leeuwen Jan 08 '13 at 15:10
  • 13
    @nbubis: I asked about known primes. – f.ardelian Jan 08 '13 at 17:53
  • This is a more interesting question from an historical perspective (i.e. before computers): see http://primes.utm.edu/glossary/xpage/TablesOfPrimes.html for a list of published tables of primes. – Douglas S. Stones Jan 09 '13 at 08:35
  • wait, about the prime numbers, I don't really get why the sum of the reciprocals of all of the prime numbers would be less than 4? Is there any proof? I would be happy to know one... – pseudo2013 Apr 24 '13 at 12:35
  • 1
    @pseudo: Note that it's not the sum of reciprocals of all primes that is less than 4 (that sum is known to diverge, so it "is infinity") -- but the sum of reciprocals of all known primes is less than 4 (there's not time enough in the universe to "know" enough primes to bring it over that). – hmakholm left over Monica Apr 24 '13 at 15:58
  • http://www.mersenne.org/various/57885161.htm I think this is the biggest prime known to man. – ciceksiz kakarot Feb 07 '13 at 14:36
  • For an approximation, one can product the largest known prime to density of primes in natural numbers ! – Fardad Pouran Jun 13 '14 at 06:15
  • 5
    Hmm, Luis Silvestre's page doesn't give any primes after 9007199254740881 for some reason. – Charles Mar 01 '16 at 15:02
  • 4
    @Charles Look at its source code. That's the limit on Javascript... – Alex Aug 04 '17 at 15:09
  • 1
    @Alex Yes, I had to know that in order to compute the last prime it was able to find. :-) – Charles Aug 04 '17 at 15:50
  • Et bien, the largest prime number thus far is $2^{77,232,917}-1$ with $23$,$249$,$425$ digits :) – Mr Pie Jun 17 '18 at 12:30
  • https://en.wikipedia.org/wiki/Prime_number_theorem there is a formula that estimates number of primes upto n, pretty simple formula is N/ln N, so you can go as high as you want – M.kazem Akhgary Apr 14 '19 at 07:34
  • 2
    OMG! the Javascript computing that list (from Luis Sylvestre) is sooo bad! It tests all numbers (odd and even) and always checks divisibility by all numbers (even and odd) up to sqrt(n) -- even when it finds a divisor it goes on up to sqrt(n)! And on top of that, it uses floating point sqrt to determine the limit for the checks, so in spite of all the superfluous computations there would be false positives in the list starting with squares of primes around 1/ε (floating point precision) if that would be reached. – Max Jun 15 '22 at 13:19
  • When is a prime number "known" ? When it is posted on a particular site ? The catch is that we can find "new" prime numbers any time within seconds because there cannot be a list of all primes with , say , $50$ digits or less and such primes can be found in less than a second (even if they should be proven prime). So, it makes no sense to count the known primes. – Peter Dec 05 '22 at 14:54

4 Answers4

75

Nobody's really keeping count.

Newly discovered large primes make the news, but primes in the range of, say, a few hundred digits are not something that anybody keeps track of. They are very easy to find -- the computer that's showing you this text is likely capable of finding at least several ones per second for you, and with overwhelming probability they will be primes nobody else have ever seen before.

There are very many hundred-digit primes to find. We could cover the Earth in harddisks full of distinct hundred-digit primes to a height of hundreds of meters, without even making a dent in the supply of hundred-digit primes.

This also raises the question of what it means that a prime is "known". If I generate a dozen hundred-digit primes and they are forgotten after I close the window showing them, are these primes still "known"? If instead I print out one of them and save the copy in a safe without showing it to anybody, is that prime "known"? What if I cast it into the concrete foundation for my new house?

  • 49
    If a prime were to fall down in a forest and nobody heard it, would it make a sound? – coffeemath Jan 08 '13 at 14:16
  • A book I read as a child made this remark: "Although the series $\sum_{p\text{ prime}} p^{-1}$ diverges, the sum of the reciprocals of all known primes is less than 4". I don't remember what book it was, but I liked the statement. Don't know if it's still true. One can avoid the ambiguity of "known" by saying that: with today's computational resources, the process of identifying primes and adding their reciprocals will not yields a number greater than $M$ in our lifetime (with some concrete value of $M$, maybe 5 or 6?). –  Jan 08 '13 at 23:53
  • 1
    (1) "If I generate a dozen hundred-digit primes and they are forgotten after I close the window showing them, are these primes still "known"?" Now you're getting too philosophical, but look at it this way: if you record somewhere the smallest and the largest prime you came across and the number of primes between them, then the desirable answer to your question that would also fit my question would be "yes" because I am interested in their number. – f.ardelian Jan 09 '13 at 02:56
  • 2
    (2) Here's another way to look at it: how many known odd positive numbers are smaller than Graham's number? The answer to that would be (g64+1)/2. They can't be listed but we have a relatively simple way of expressing how many they are. – f.ardelian Jan 09 '13 at 03:08
  • 3
    @f.ardelian: We have a good way of expressing $\pi(n)$, the number of primes less than $n$, but as the numbers get large we don't know which ones are prime. Your question seemed to be interested in which ones are prime. For any given number, we can check it reasonably easily if it is less than $10^{200} $ (say), but there are so many we can't check them all. – Ross Millikan Jan 09 '13 at 05:32
  • 1
    @5PM, the sum of the first 1 million prime reciprocals is 2.88733 and Mathematica is still running on my laptop to add 10m of them. – alancalvitti Feb 07 '13 at 15:29
  • 2
    Just an update, the sum of the first 10m prime reciprocals is 3.04145. – alancalvitti Feb 07 '13 at 15:45
  • @alancalvitti Thanks. Since the $n$th prime is about $n\log n$, the partial sums $\sum_{n=1}^N 1/p_n$ grow as $\log\log N$. So, the number of primes required to reach the sum $S$ is $\approx e^{e^S}$. In particular, the number of primes required to get $4$ is roughly $10^{15}$ times the number of primes required to get $3$. Not to mention that the rate at which new primes are found and incorporated into the sum will decrease as numbers grow larger. –  Feb 07 '13 at 16:14
  • @5PM, re "rate at which new primes are found and incorporated into the sum": do you mean the rate in time or the spacing of primes among the integers? I assume you mean the former but aren't the estimates you provided valid for the first $n$ primes regardless of which are found, due to the asymptotic $n$ log $n$? – alancalvitti Feb 07 '13 at 18:09
  • @alancalvitti I guess saying "rate" here is confusing. I was just stating that one must find $\approx \exp \exp(3)$ primes to get the reciprocal sum of $3$, and $\exp\exp(4)$ primes to get the sum of $4$. We can see how much more difficult the second task is by realizing that: (i) $\exp \exp(4)\approx 10^{15}\exp\exp(3)$, and (ii) If $T(N)$ is the time it takes to find $N$ prime numbers, then $T(10^{15}N)$ will be substantially greater than $10^{15}T(N)$ because larger primes are more costly. –  Feb 07 '13 at 19:41
  • 6
    @5PM, I was at a talk some years ago where the speaker said, "The sum of the reciprocals of all known primes is less than $4$, and always will be." – Gerry Myerson Feb 08 '13 at 05:16
  • 1
    @5PM, errata: my reported sums were actually sums of reciprocals of primes less than resp. 10^6 and 10^7. The sum of reciprocals of the first 10^6 (10^7) primes is actually 3.06822 (3.20622). This took ~48 s (~1161 s) on a Mac Pro laptop. – alancalvitti Feb 09 '13 at 03:22
  • I was told that the number of bitcoins corresponds to the number of known primes; perhaps some people care about the number for that reason? – inkievoyd Dec 12 '17 at 14:20
  • 2
    @inkievoyd: What you were told is wrong. The supply of bitcoins increases slowly on a predetermined schedule which has nothing to do with discovering (or knowing) primes. – hmakholm left over Monica Dec 12 '17 at 16:34
  • @HenningMakholm I thought that was strange so I followed up and indeed, I was told wrong. Thanks. – inkievoyd Dec 13 '17 at 18:23
  • These days, my mind feels that it could in theory just assert what ever it wants when it's too complicated to verify. I could pretend that the Mersenne prime bases are what ever I want them to be. It makes no difference. It's too complicated to verify except it's obvious that 11 and 23 are not Mersenne prime bases and that 2, 3, 5, and 7 are. I could assert different things whether they're true or not for a change. – Timothy May 12 '20 at 02:55
  • @coffeemath: Yes, but it must only fall as a single, full-sized mass, all the way to the ground, of course (e.g. it cannot break apart into smaller pieces). I'm a woodworker, and I spent some time trying to harvest and kiln dry prime trees. That's what killed my nascent business in the end. I missed the obvious: they may be easy to fell and easy to dry, but there's just no good way to reduce them down into whole slabs after that. Wound up having to cut them all to fractional sizes. Damn near lost my shirt. If anyone's in the market for a non-orientable canoe, though, HMU! – NerdyDeeds Apr 17 '23 at 19:18
11

In order to get a rough estimate, I checked performance of PrimeQ function in Mathematica on my computer. It appears, that in order to calculate all primes up to $10^n$ using this function, I need $\approx11^{(n-6)} \mathrm{seconds}$ on my single core of amd athlon 7750. Then it would take me for example $\approx1500$ years to calculate all primes up to $10^{16}$, and as a result I would get $10^{14}$ primes.

As @Henning Makholm said

Nobody's really keeping count (of prime numbers).

It is probably because it is more efficient to calculate them when needed than to store them. And since for cryptography, only very large primes are important, no one really needs those small ones.

gglon
  • 139
  • 4
    A sieve is much more efficient yet. It takes a second or two to build a table of primes up to $10^8$. One could easily use this to compute all the primes up to $10^{16}$ in a matter of weeks rather than centuries (but yes, storing them is another matter). – Erick Wong Feb 07 '13 at 15:20
7

I came across this interesting resource:

The first fifty million primes

Lists the first and last prime of sets of one million, and a more recent record:

New record prime (GIMPS): $2^{82,589,933}-1$

with 24,862,048 digits by P. Laroche, G. Woltman, A. Blosser, et al. (7 Dec 2018)

Source: The primes page (utm.edu)

I also found the first 2 billion prime numbers, which isn't an academic site, but has links to some other prime databases.

DukeZhou
  • 439
  • I decided to upvote this answer. I noticed that it can be thought of as an add on to Monica's answer. Although we aren't keeping count of all the 100 digit prime numbers each of which would have been so fast to verify are prime, we are keeping count of Mersenne prime bases. – Timothy May 12 '20 at 03:03
0

It turns out that an approximate answer can't even be computed by WolphramAlpha. I hope I got this right:

We start from the accepted answer to the question Finding the 2,147,483,647th prime number, which says that according to the prime number theorem there is

$$\pi(n)\approx\frac{n}{\log(n)}$$

where $\pi(n)$ is the number of prime numbers less than $n$. The largest known prime, discovered in 2008, is $2^{43,112,609}-1$, but if we put that in the place of $n$ we get an answer so big that not even WolframAlpha can compute $\pi(n)$ (no need to click on it, because it doesn't work).

However, we can still find an approximate answer thanks to the list of 10 largest known primes. The largest number for which WolframAlpha still works is currently ranking 3rd on that list and its value is $2^{37,156,667}-1$ from which we get that there are approximately $7.853*10^{11,185,263}$ (or $10^{10^{7.04865}}$) primes smaller than $2^{37,156,667}-1$ using the $\pi(n)$ formula.

  • 1
    Dear f.ardelian, There is something strange with your claim about computing $\pi(n)$, because if you can write down $n$ --- which you can, you just wrote that it's $2^{43,112,609} - 1$, then you can write down $\log n$ --- its roughly $30,000,000$ --- and then you can compute $n/\log n$ --- it's roughly $2^{43,112,584}$. Regards, – Matt E Jan 09 '13 at 04:00
  • 3
    The asymptotic formula for $\pi(n)$ does not require $n$ to be prime. I can plug in $$n=10^{10^{10^{10^{10^{10}}}}}$$ and get $$\pi(n)\approx (\log(10) )^{-1}\cdot 10^{10^{10^{10^{10^{10}}}}-10^{10^{10^{10}}}}$$ –  Jan 09 '13 at 04:33
  • 4
    This ignores OP's point (a good one) that there are many primes below the few largest known that are not themselves known. – Ross Millikan Jan 09 '13 at 05:26
  • @MattE Are you sure? According to WolframAlpha, $\log(2^{43,112,609}) \approx 2.988*10^{7}$ https://www.wolframalpha.com/input/?i=log%282%5E43%2C112%2C584-1%29 – f.ardelian Jan 09 '13 at 14:25
  • @PavelM I don't get your point. – f.ardelian Jan 09 '13 at 14:28
  • Dear f.ardelian, I'm a bit confused about what you wrote, since $2.988 \times 10^7$ is roughly $30,000,000$, so I seem to be in agreement with WAlpha. Regards, – Matt E Jan 09 '13 at 18:56
  • 4
    Only a ridiculously small fraction of those $10^{10^7}$ primes are "known" (in any meaningful way), though. – hmakholm left over Monica Feb 07 '13 at 19:04
  • 8
    It is known that there are exactly $1,699,246,750,872,437,141,327,603$ primes less than $10^{26}$ but not all of these are known primes. See Douglas Staple's thesis – Henry Jun 01 '16 at 23:31