Prime number algorithm
Posted on 2003-02-27
I need to write a method or function that accepts a numeric argument and returns a boolean true if the number is a prime number and false if it is not.
Also I would like it to be as accurate as possible, preferably in the 99.999% range (may need the Miller-Rabin test but this is only a suggestion I do not fully understand this test myself).
It will also require minimal processing resources. Therefore the method should break as soon as the first test fails.
I prefer it be in Java and have comments to explain the algorithm and math or it will be useless to me. (If I cant understand the math no points will be awarded).
This will require both math and programming expertise therefore it is listed as 200pts. Both processing resources reqiured and accuracy will be considered for rewarding points.
Thank You ahead of time. I could not do this on my own.