isPrime

Returns true when n is a prime number.

Uses deterministic trial division by 2, 3, and then candidates of the form 6k plus or minus 1, so the running time is O(sqrt(n)). Values below 2, including all negative values, return false.