#7017: prime_range problem
-----------------------------+----------------------------------------------
Reporter: kevin.stueve | Owner: kevin.stueve
Type: defect | Status: needs_review
Priority: critical | Milestone:
Component: number theory | Keywords: prime_range, primes, prime number
theory, prime
Work_issues: | Author: kevin.stueve
Upstream: N/A | Reviewer: was
Merged: |
-----------------------------+----------------------------------------------
Comment(by craigcitro):
I haven't looked closely at the patch. The one quick note I can make is
that it looks like a few uses of double-quotes should be changed to
backquotes, i.e. everything that should appear as `code`.
More important to me is the segfault. The problem is this: when I wrote
this, I clearly only tested with large input on my 32-bit machine, where
I'm getting the same behavior as Kevin -- the code converts the input to
an int, which is sufficient to stop overly large input on a 32-bit
machine, but fails horribly on a 64-bit machine. I think the segfault is
coming from Pari trying to double its stack appropriately, maybe?
There are a number of easy solutions, but I think the most robust would be
to just hardcode an upper bound: if the user asks for a range with one of
the parameters larger than our fixed bound, we should just fall back to a
different method. The docs already say something about not using this with
large input -- we just need to change that to say that it automatically
switches algorithms for sufficiently large input. In fact, I think that if
we do this, we don't even need the `algorithm` argument to `prime_range`
... Then the only question left is to decide what the bound should be.
Just computing the primes in pari for `10^10` takes ~40s on my laptop;
maybe `5*10^10` is a reasonable bound? I'm trying `10^11` right now, and
my machine isn't loving it ... we should see what a reasonable bound is
on, say, sage.math.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7017#comment:5>
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.