Sunday, April 25, 2010

Proving primality : Testing whether a particular number is prime or not

Many a times computer science students are faced with problems whose sub-problem involves testing whether a chosen number is a prime or not.

Finding primes & proving primality

In the above link, you will find very good resources about primality testing and proving.

I have implemented an algorithm which lets you test whether a number  (17 < N < 341,550,071,728,321) is a prime or not.

The link to the python code is here

The code is nicely written but not well documented. You can extend the valid limit for numbers by adding extra conditions in the code.


1 comment: