Prime visits of pmo

https://ide.codingblocks.com/s/168484 it shows the time limit exceeds

@Learning_bunny You have to use Sieve of Eratosthenes for primes in this problem. The test cases are large and so without this it will give TLE. Lecture video of Sieve of Eratosthenes is there in the Number Theory section of your course. Please refer that first and then try to solve this problem using that concept.