Tests whether a given number is prime.