isPrime method done.