Prime visits problem

whats going wrong here??

@sounakume you don’t need function showrangeprimes in your code just iterate all the numbers from a to b and count the numbers if it is prime.

But segmented sieve should work,right.
Contraints are large. Iterating is giving me tle.

Hey @sounakume you don’t need to call isprime() for every query ,instead you can precompte the values in a prime array. I made the required changes in your code please take a look https://ide.codingblocks.com/s/184528

I hope your doubt is resolved and if so please kindly mark the doubt as resolved.