Prime visits question

one testcase saying time limit exceeded.Why?

hi @dbhavanishankar89 for the prime visits question you are supposed to use the optimized method for finding prime numbers (Sieve of Eratosthenes). The brute force method will give tle only