-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a combinatorial prime number counter #28
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! You should hear from @huonw (or someone else) soon. |
Codecov Report
@@ Coverage Diff @@
## master #28 +/- ##
==========================================
- Coverage 51.22% 49.06% -2.16%
==========================================
Files 17 20 +3
Lines 3934 4537 +603
==========================================
+ Hits 2015 2226 +211
- Misses 1919 2311 +392
Continue to review full report at Codecov.
|
Thanks for the PR. That speed-up looks great! Unfortunately I'm going to be away for a few weeks, so won't be able to do anything with you. Maybe @cuviper is interested? |
Sure! No rush here - I'll continue to commit and try to speed things up in the meantime. At the moment, I'm just playing around with speeding up the current implementation, but probably around December I'll try to implement the Delaglise, Rivat and perhaps Gourdon algorithms instead of the naive version now, which should hopefully get another few orders of magnitude of speed out for larger numbers. Latest commit has 10^10 down, and I suspect the point at which this is better than the prime_pi method has shifted down as well, but I haven't looked too hard at that:
|
I am interested, but not able to work on it at the moment. I'll try to come back to this. |
Hey - this PR adds a combinatorial prime number counting function that speeds things up for larger numbers. I'm hoping to speed it up much more in the future (it's far from optimal currently), but I figured I'd get the right api sorted out first.
Currently, this implementation is slower at evaluating pi(n) for n < 10^7, but faster for values larger than about that. It's more than 10x faster by the time you get to 10^10 - looking at benchmarks on my computer:
Please let me know if there's anything you want changed, or if you don't want this in this repo, in which case I'll move it elsewhere.