Showing posts with label monte carlo algo. Show all posts
Showing posts with label monte carlo algo. Show all posts

Wednesday, 3 February 2016

Miller Rabin Primality Testing Algorithm in C language

  1. This algorithm is a monte carlo algorithm used for testing whether a given number is a prime or not. 
  2. This works much better than fermat's theorem.
  3. This algorithm is likely to give false positive in case of Carmichael numbers.
  4. The code implementation given below will not work with any number less than three.
  5. This code contains a large number of commented out printf statements which i added during debugging. However I decided against removing them as I though it might help some one whose trying to understand the working of the algorithm.