finish solution for isPrime