Prime visit problem

it is showing-test case 2 and 3 run error

it is giving correct output but still showing test cases 2 and 3 run error.Pl resolve

Plz use prime seive for prime numbers , then only run error can be prevented

what is prime seive?

pl share the code of the above problem

pl resolve the problem

You can refer to 2 videos under Number theory section : Seive of Erathosenes, and Optimisations in Prime Seive, For your reference , I am including only the prime Seive logic, rest code you need to complete on your own, if u are not able to solve it, kindly let me know :