I've noticed two issues with random_prime() in Sage.

1) Whilst Sage's random_prime() looks as though it will work for numbers to at least 10^100000000, if one specifies a lower bound, then the upper bound reduces to 2^40, which is about 10^12.

This situation does *not* change if one specifies one only wants a pseudo prime.

sage: random_prime(10^13,proof=False, lbound=12)
<snip>
NotImplementedError: computation of prime_pi() greater 2**40 not implemented

http://trac.sagemath.org/sage_trac/ticket/10277

Mathematica 7.0.1 has no such limitation. One can set a lower bound, and still have an upper bound to at least 10^100000000


2) The Sage implementation is incredibly slow compared to Mathematica.

On my machine (a 3.33 GHz Sun with !OpenSolaris) using a 32-bit build of Sage, it took 1455 seconds to generate a random prime up to 10^1000.

Mathematica 7.01 does this in 7 seconds.

http://trac.sagemath.org/sage_trac/ticket/10278

If Mathematica does use a pseudo prime test, it is not documented.

http://reference.wolfram.com/mathematica/ref/RandomPrime.html


Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to