Added a O(sqrt(n)) primality test