Whoops, I just looked at the code again. Wouldn't it be much better to call pari's "next_prime" function. Test for primeness, if true, return, if false, call next_prime again etc...?
That should be ***much*** faster than the current method. Michel On Jun 7, 8:38 pm, Michel <[EMAIL PROTECTED]> wrote: > Hi, > > This thread started because (...).next_prime() > and next_prime(...) behave differently. So I assume this > can be fixed immediately? > > As to provable/probabilistic. I am worried about > global modes since people will forget about them.... > > Michel > > On Jun 7, 8:19 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > > > On 6/7/07, David Harvey <[EMAIL PROTECTED]> wrote: > > > > > I agree too, though I think is_prime should remain provably correct. > > > > I disagree. I think is_prime should have the same option available, > > > and the default should be probabilistic. > > > > The idea of these probabilistic tests is supposed to be that the > > > probability of error is far less than the probability of error in > > > your hardware (bounded uniformly, regardless of the input). Whether > > > or not you are searching for the *next* prime or testing a *specific* > > > value to be prime shouldn't affect your choice of algorithm. In the > > > majority of applications the probabilistic test is the one a user > > > would want, given the speed difference. > > > No. Absolutely throughout SAGE I have in every possible case made > > the choice proof=True the default, and here the intension for is_prime > > is that proof=True be the default. I'm am deeply opposed to > > having proof=False the default for any SAGE functions. However, > > one of the SAGE Days 4 coding sprint projects is to implement an > > easy-to-use global function "proof": > > > def proof(on=True): > > """ > > proof(True) -- turns proof on globally by default > > proof(False) -- turns proof off globally by default > > """ > > > The real work here is to retrofit every function in sage that has a proof= > > option to now say "proof='default'" by default, which will then respect > > the choice made by the proof command above. People could put proof(False) > > in their init.sage if they are applied mathematicians... If you're > > claiming > > a result for a paper, you definitely remark that you ran the computation > > in SAGE after typing "proof(True)". > > > I am not going to argue with David Harvey and others about specifically > > whether the function is_prime should have proof=True or False by default. > > I think the decision about the proof parameters for algorithms should > > be a global decision -- i.e., have the default always be true or always be > > false. In PARI, e.g., the default is always false. In MAGMA it is always > > True (at least that's the goal). > > > This uniformity should be throughout the system and should only be > > invalidated when the function name specifically indicates it. E.g,. we > > should > > add > > is_probable_prime > > and that would always have proof=False (it wouldn't even have a proof > > parameter). > > > William > > > -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---