solution for IsPrimeNumber