Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Rabin Miller

by Anonymous Monk
on Mar 17, 2011 at 19:51 UTC ( [id://893843]=note: print w/replies, xml ) Need Help??


in reply to Rabin Miller

This code will pass 4294967296 (2**32) as a prime!

Quick fix:

sub RabinMiller { my $p = shift; my $b = 0; my $m = $p - 1; my $t = 20; # The probability of error is .25 ** $t # Probability of error with $t = 20 is lt 10 ** -12. return 0 if ($p % 2 == 0 && $p > 2); .....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://893843]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found