#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: | Author: R. Andrew Ohana
Merged: | Dependencies:
-----------------------------+----------------------------------------------
Comment(by rohana):
So through the updates, I haven't been keeping `legendres_formula` up to
date. I am posting a patch that should fix the bugs that were present for
the past few versions (primarily, calling it with a relatively small `x`
in comparison to `a` would give an extremely wrong answer due to overflow
issues). I have also changed the name, so it now is called either
`legendre_phi` or `partial_sieve_function`.
The patch also makes all documentation use `^`, there are no longer any
instances of `**`.
The patch also touches up on `__phi` and `__phi32` -- cleaning up code,
adding a few comments, and makes a simple optimization to reduce boolean
checks for small `x` values (~10% speedup for large input).
I'm hoping this will be the final patch for this ticket, so that I don't
go into the double digits for version numbers :-).
Apply only trac_11475v9.patch
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11475#comment:40>
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.