✔ 最佳答案
The only way is by searching, but yuo can limit your search range by applying Bertrand's postulate :
for every n > 1 there is always at least one prime p such that n < p < 2n
Then you can search the range of [n/2, 2n] and find the prime out.
Another way to limit search is by approximation . From PNT, we have
nth prime number ~ nln(n)
then you can find k such that (k-1)ln(k) < n
2007-04-06 12:46:36 補充:
The last sentence is:then you can find k such that n within [ (k-1)ln(k), kln(k) ] and search the prime out