Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-24 Thread Solomon Foster
On Mon, Sep 24, 2012 at 10:09 AM, Richard Nuttall wrote: > A quick search throws up http://primes.utm.edu/prove/prove2_3.html > > Which says that for/n/< 341,550,071,728,321 it is enough to test 2, 3, 5, 7, > 11, 13 and 17 to be definitive (and fewer specific tries for smaller n) > > That also ver

Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-24 Thread Richard Nuttall
A quick search throws up http://primes.utm.edu/prove/prove2_3.html Which says that for/n/< 341,550,071,728,321 it is enough to test 2, 3, 5, 7, 11, 13 and 17 to be definitive (and fewer specific tries for smaller n) That also verifies the 75/25 figures mentioned below. So, depending on the i

Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Stephen Pollei
On Thu, Sep 20, 2012 at 9:22 PM, Martin Kealey wrote: > On Thu, 20 Sep 2012, Stephen Pollei wrote: > According to Wolfram, it's 75/25; so a positive result after 10 iterations > leaves about a one-in-a-million chance of being composite (more precisely, > one in 1048576). I'd believe wolfram over

Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Martin Kealey
On Thu, 20 Sep 2012, Stephen Pollei wrote: > If it says it might be prime it's > about a 50% 50% split if it's correct. According to Wolfram, it's 75/25; so a positive result after 10 iterations leaves about a one-in-a-million chance of being composite (more precisely, one in 1048576). > multi me

Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Stephen Pollei
On Thu, Sep 20, 2012 at 11:36 AM, Martin D Kealey wrote: > On Wed, 19 Sep 2012, GitHub wrote: >> Log Message: >> --- >> Add expmod and is-prime as built-ins in Int > >> +Returns True if C<$x> is known to be a prime, or is likely to be a >> +prime based on a probabilistic Miller-Rabin

Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Martin D Kealey
On Wed, 19 Sep 2012, GitHub wrote: > Log Message: > --- > Add expmod and is-prime as built-ins in Int > +Returns True if C<$x> is known to be a prime, or is likely to be a > +prime based on a probabilistic Miller-Rabin test. (The optional > +argument tells how many times to iterate