#11475: improve prime_pi (speedup + small fixes)
--------------------------------------------------+-------------------------
Reporter: rohana | Owner: was
Type: enhancement | Status:
needs_review
Priority: major | Milestone: sage-4.7.1
Component: number theory | Keywords: primes,
prime counting, prime_pi
Work_issues: | Upstream: N/A
Reviewer: Yann Laigle-Chapuy, Leif Leonhardy | Author: R. Andrew
Ohana
Merged: | Dependencies:
--------------------------------------------------+-------------------------
Comment(by leif):
Another corner case:
{{{
sage: legendre_phi(1000,10^10)
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call
last)
/home/leif/Sage/sage-4.7.1.alpha3/devel/sage-11475v9/<ipython console> in
<module>()
/home/leif/Sage/sage-4.7.1.alpha3/local/lib/python2.6/site-
packages/sage/functions/prime_pi.so in
sage.functions.prime_pi.legendre_phi (sage/functions/prime_pi.c:5888)()
/home/leif/Sage/sage-4.7.1.alpha3/local/lib/python2.6/site-
packages/sage/functions/prime_pi.so in
sage.functions.prime_pi.legendre_phi (sage/functions/prime_pi.c:5517)()
NotImplementedError: computing legendre_phi for a > prime_pi(2^32-1) not
implemented
sage:
}}}
(The message is a bit misleading by the way, since we limit '''`x`''' to
64 bits, and therefore the result is independent of `a >= 2^32`. If at
all, I'd also give the numerical upper limit for `a`, i.e. 203280221. But
as I said, there isn't really any limit on `a`.)
[[BR]]
Also, '''don't try this at home''':
{{{
sage: time legendre_phi(1000,10^8)
}}}
(I fortunately could kill the process before the almost freezed machine
went out of swap space. Apparently computing the list of primes is
uninterruptable, which worsens the situation.)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11475#comment:43>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.