On Sep 4, 11:03 am, Jeff Gilchrist <[email protected]> wrote:
> On Thu, Sep 3, 2009 at 10:51 PM, Jason Moxham<[email protected]>
> wrote:
> > Or getting rid of the mpz_next_prime_thing all-together , cant say I like it
> > much. What do people use it for ?
>
> I actually use it and find it very useful. If I'm doing some kind of
> testing or other calculations on increasing primes it is very useful
> just to call that function to get the next one to work with.
Its normal use is to offer a fast way of first generating a random
number and then quickly finding the first likely prime above this
number without applying a relatively costly test to each number in
turn. This is normally done with a sieve for several hundred small
primes.
But as currently implemented it uses mpz_next_probable_prime()
directly and this is pretty useless since it applies a prime test to
numbers in turn. It doesn't even screen out even numbers!
Looking quickly at the code, it seems that a version with sieving has
been written but it hasn't been tested or enabled.
But I agree with Jeff - it is useful to be able to generate a random
number and then have a fast way of looking for possible primes above
this value to pass to a prime testing algorithm.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"mpir-devel" 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/mpir-devel?hl=en
-~----------~----~----~----~------~----~------~--~---