On Wednesday, April 2, 2014 1:20:23 PM UTC-7, Szabolcs Horvát wrote:
>
> Hello,
>
> I'm quite new to Sage.  Does it have any functionality that will easily 
> compute the Nth prime and it's fast enough that it will work for N of the 
> order 10^9 or 10^10 reasonable quickly (say, under 10 seconds)?
>
> pari.nth_prime(1000000000) takes a very long time.
>
perl -MMath::Prime::Util=:all -E 'say nth_prime(10**10)'

10^10 in 0.04s
10^11 in 0.13s
10^12 in 0.81s
10^13 in 2.9s
10^14 in 13.3s

All single threaded.  Open source from CPAN or 
https://github.com/danaj/Math-Prime-Util

Kim's primecount uses the excellent threaded primesieve, but the nth prime 
is currently quite a bit slower.  MPU uses a low-biased estimate (inverse 
Li with small correction), uses LMO prime count, then sieves the tiny gap.  
The prime count is also quite a bit faster at the moment.  Both are 
actively being worked on so relative times are always in flux.  I'm sure my 
sieving will never match his performance.

The code is all in C and C+GMP (with Math::Prime::Util::GMP).  I don't know 
how well any of it would mesh with SAGE, but there's lots of stuff there 
that would seem useful (e.g. ECPP).

Dana

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to