#10784 closed enhancement (fixed)
primes can have better functionality.
Reported by: | mderickx | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-4.7 |
Component: | number theory | Keywords: | prime, iterator, beginner |
Cc: | niles | Merged in: | sage-4.7.alpha2 |
Authors: | Douglas McNeil | Reviewers: | Karl-Dieter Crisman |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
In this topic: http://groups.google.com/group/sage-devel/browse_thread/thread/cd05585cf395b3a0/c7c82fbb725dee50
D.S. McNeil posted several ideas for enhancing sage. This ticket is for the enhancements proposed for the primes function.
(3) primes(10, infinity) should work. Since we're just calling next_prime, there's no reason to require the upper limit to be an integer. Wouldn't mind a proof=False option which calls next_probable_prime instead, either.
Apply trac_10784_primes_enhancements.patch and trac_10784-reviewer.patch
Attachments (2)
Change History (11)
comment:1 Changed 10 years ago by
- Component changed from PLEASE CHANGE to number theory
- Milestone set to sage-4.7
- Owner changed from tbd to was
- Type changed from PLEASE CHANGE to enhancement
Changed 10 years ago by
comment:2 Changed 10 years ago by
Patch attached to allow support for infinity as upper bound and proof option (with same semantics as next_prime's proof option: it's simply passed through to next_prime).
First idea was to avoid casting to ZZ entirely, which would allow primes(2, 100/3), but that can lead to some mysterious error messages. Current approach simply special-cases infinity as an upper bound -- allowing -infinity as a lower bound isn't that useful, because unlike the case of an infinite upper bound, that can be easily worked around from outside the function, and so problems with the bounds are caught at first iteration, which seems better.
comment:3 Changed 10 years ago by
- Summary changed from primes can have better functionallity. to primes can have better functionality.
comment:4 Changed 10 years ago by
- Cc niles added
- Description modified (diff)
- Keywords prime iterator beginner added
- Status changed from new to needs_review
Looks really good -- I've marked it as 'beginner', meaning that this is a patch which someone who is just beginning could review. If no one beats me to it, I'll go ahead and review it :)
comment:5 Changed 10 years ago by
- Description modified (diff)
- Reviewers set to Karl-Dieter Crisman
- Status changed from needs_review to positive_review
This is a great patch, nicely tested. I've made some minor tweaks in the documentation to remove some errors in the docbuild and a few other things like indentation, and added one doctest. Positive review.
comment:6 Changed 10 years ago by
- Description modified (diff)
comment:7 Changed 10 years ago by
- Description modified (diff)
comment:8 Changed 10 years ago by
- Merged in set to sage-4.7.alpha2
- Resolution set to fixed
- Status changed from positive_review to closed
allow +infinity, proof