checks whether a number is prime or not