added function for checking if number is prime