Why I am getting timelimit exceeded error

@coe17b030 this question requires the knowledge of a particular concept called Sieve of Eratosthenes, which is covered under the Number Theory section.
Iā€™d have to ask you to hold on to this question until you reach that section in the course. Meanwhile, you can try other topics.