b r a y d e n . o r g / Software

/ WebHome / SecurityPages / CryptographyInfo / PrimeNumbers

This Web


WebHome  
Topic List  
Web Statistics 

All Webs


Books
Main
Random
Software
TWiki  

brayden.org


Home
Monthly Digest
Today's Links
Resumé
Reading List
Books RSS
Random RSS
Software RSS

Other


Dale's Blog

currently-reading
TextDrive

Prime Numbers


Links


Rabin-Miller Test

Choose a random number, p, to test. Calculate b, where b is the number of times 2 divides p-1. Then calculate m, such that p = 1 + 2b*m.

  1. Choose a random number, a, such that a is less than p.
  2. Set j = 0, and set z = am mod p.
  3. If z = 1, or if z = p - 1, then p passes the test and may be prime.
  4. If j > 0 and z = 1, then p is not prime.
  5. Set j = j +1. If j < b and z <> z2 mod p go back to step 4. If z = p - 1, then p passes the test and may be prime.
  6. If j = b and z <> p -1, then p is not prime.

The odds of a composite passing decreases faster with this test than with previous ones. Three-quarters of the possible values of a are guaranteed to be witnesses. This means that a composite number will slip through t tests no more than žt of the time, where t is the number of iterations. Actually, these numbers are very pessimistic. For most random numbers, something like 99.9 percent of the possible a values are witnesses.

 
 
Current Rev: r1.2 - 03 Dec 2002 - 06:45 GMT - DaleBrayden, Revision History:Diffs | r1.2 | > | r1.1
© 2003-2011 by the contributing authors.