Write method to check whether or not a number is prime