Test case3 shows timelimit

This questions requires the knowledge of a particular topic called sieve of eratosthenes.
That topic is covered under the Number Theory section of the course. I would request to hold on this question till the time you reach that section in the course.
Thank you.