0

I am having some fun with prime numbers and I am in need of a lot of prime numbers. Maybe I do not need all of them in order.... say, something like this would be enough:

What is the 1,000,000th prime? That one (up to the 50,000,000th prime) can be picked from the files in https://primes.utm.edu/lists/small/millions/, but I would like to get the 100,000,000th, 200,000,000th and so on.... or even 1,000,000,000th and larger. So, I could avoid getting all of the primes, but I need to be able to find what the primes are in specific positions (positions which, to my untrained ears, sound like large positions). Perhaps there is a web service that I could hit programmatically? That would be awesome.

eftshift0
  • 147
  • Relevant discussion: https://math.stackexchange.com/questions/507178/most-efficient-algorithm-for-nth-prime-deterministic-and-probabilistic – Matti P. Jan 27 '23 at 08:24
  • Do you really want to have the database ? Or is it enough if you can determine the $n$ th prime for large $n$ fast ? For the latter there are efficient algorithms. But databases storing the primes upto the $10^9$ th one are quite useless since so small primes can be very quickly generated when needed. Nevertheless , someone might have generated them, but I have no clue whether this is the case. – Peter Jan 27 '23 at 10:40
  • Nope, no real need for a DB.... a plain file (or files) with the numbers would suffice.... or being able to request somehow the nth prime. – eftshift0 Jan 27 '23 at 10:41
  • 1
    If you download the free PARI/GP tool , you can very quickly generate small primes (say upto $20$ digits) , as many as you want. – Peter Jan 27 '23 at 10:42
  • 1
    PARI/GP also has a built in function "prime(n)" , finding the $n$ th prime, it $n$ is not too large. Not sure if it is efficient enough for your purpose. – Peter Jan 27 '23 at 10:44
  • Interesting. This is what my package manager says about it: pari-gp - PARI/GP Computer Algebra System binaries. Will take a look at it. – eftshift0 Jan 27 '23 at 10:44
  • Found SymPy too. – eftshift0 Jan 27 '23 at 13:58

0 Answers0