home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math
- Path: sparky!uunet!mcsun!Germany.EU.net!news.uni-bielefeld.de!achim
- From: achim@unibi.uni-bielefeld.de (Achim Flammenkamp)
- Subject: Re: nth prime
- Message-ID: <1992Sep11.133129.23901@unibi.uni-bielefeld.de>
- Date: Fri, 11 Sep 92 13:31:29 GMT
- References: <1992Sep10.190905.10741@waikato.ac.nz>
- Organization: Universitaet Bielefeld
- Lines: 18
-
- In article <1992Sep10.190905.10741@waikato.ac.nz> bill@waikato.ac.nz writes:
- >Sorry to ask such a FAQ, but what's the quickest algorithm to
- >find the nth prime? Is it O(nlogn) or something else?
- >
- I think it is not a FAQ :)
-
- You have to calculate the "inverse function" of PI(n), the number of primes
- less than n. There are clever algorithmns like the telescop method of Meissel
- to calculate PI(n) in time O(n^2/3). Look for a recent calculation in Math.
- of Computation about 1985 from Odlytzko (probably spelled wrong, sorry). They
- calculated PI(x) upto 4*10^16. Maybe today there are algorithmns availible
- which have a running time of n^k with 1/3<k<2/3. To get the nth-prime you have
- to too a binary search on PI(n) roughly spoken , order log(n). So you will
- get the nth-prime in about n^k which k <= 2/3.
- My personally opinion is that the theoritical bound is less than n^eps for
- each postive eps , but to find such an algorithmn you have to understand the
- prime distribution totally :)
- achim
-