Checks whether a given is prime or not