Primality checking

Here are some files for you to use in testing primality checking programs.

digits smallest number smallest prime
20  IN20
100  IN100a IN100p
200  IN200a IN200p
500  IN500a  
1000  IN1000a  

I wrote a primality checking program, and I think that it is pretty fast.  With loopcount=20, on my 2.8 GHz PC, it takes about 0.1 seconds to check a 100-digit prime and about 48 seconds to check a 1000-digit prime.  (On my more modern Duo 2.4 GHz machine, it takes about 25 seconds.)  The PC executable is available for downloading.

You will write your own primality checker.  I do not expect that you will be able to write code as efficient as is mine, but you should be able to check a 100-digit number in under 10 seconds.  Extra credit if yours is faster than mine!


Dan Hirschberg
Computer Science Department
University of California, Irvine, CA 92697-3435
dan (at) ics.uci.edu
Last modified: April 11, 2011