Deepak and Primes

Getting runtime error in 2 Test cases
Please Help me sir in this problem
my solution is this:-Deepak and Primes