7
$\begingroup$

$2$ is the first prime number.

$3$ is the second.

If I give a prime number such as $1151024046313875220631$, is there any software/website which can give the position of the prime number?

I know there are resources to find $N$th prime. But I am having a hard time finding the reverse.

  • 2
    You can always use binary search.2010-08-17
  • 0
    Sieving is more or less what Mathematica does, using the logarithmic integral as an (over)estimate.2010-08-17
  • 1
    Your number (~10^21) is probably too big for that.2010-08-17
  • 0
    I don't think there is online resource to find the ($2.4\times10^{19}$)th prime.2010-08-18

6 Answers 6

0

For primes smaller than your example you can use Wolfram|Alpha, as Adam S pointed out. Wolfram|Alpha has the prime Pi function:

http://www.wolframalpha.com/input/?i=pi(55252335667)

5

You can use the function prime_pi in Sage (http://sagemath.org), which is also available for free online at http://sagenb.org. For example,

   sage: prime_pi(2011)
   305

Like Mathematica, Sage's prime_pi function is too slow to solve your problem above. It's also somewhat slower than Mathematica's still.

2

If you have access to Mathematica, PrimePi[x] will give you the number of primes less than x. Combined with PrimeQ, which verifies that x is indeed prime, will give you which prime number x is.

EDIT: I have no idea how long Mathematica would take (or if it could in fact compute it) for a number that high.

  • 3
    Mathematica has a built-in ceiling for both Prime[] and PrimePi[]; see the documentation for the error message PrimePi::largp. This is probably both version and machine dependent.2010-08-17
  • 0
    That number is too big for even the 64-bit version of Mathematica 7.2010-09-08
2

What you are looking for is the "Prime Counting Function". The closest thing to it you will find online is Wolfram Alpha:

http://www.wolframalpha.com/examples/PrimeNumbers.html

2

If an approximation suffices, you could use the offset logarithmic integral function.

2

Andrew Booker's Nth prime page is excellent... but it can't handle your example number.

I have custom code that can calculate values up to about 2^64, but your number is larger than that.

Thanks to Dusart [1], we can say that its rank is somewhere between 24244547260299402427 and 24247918127257270377.

If the Riemann Hypothesis is true, then we know by Schoenfeld [2] that its rank is somewhere between 24245911027060346607 and 24245911157987206331.

[1] Pierre Dusart, 'Estimates of Some Functions Over Primes without R.H.', preprint (2010), arXiv:1002.0442

[2] Lowell Schoenfeld, 'Sharper Bounds for the Chebyshev Functions theta(x) and psi(x). II'. Mathematics of Computation, Vol 30, No 134 (Apr 1976), pp. 337-360.