Assuming you're going to write a function / method to search for a prime, what would be the most efficient way to do this? I think this will be a test that looks something like this:
Code below in semi-C ++
bool primeTest (int x) {
Does anyone have a better way to solve this that would require less computation?
Edit: Changed the code a bit, twice. I did not write this in the light of any particular language, although I believe that it is C ++ over java due to the word bool.
source share