time limit is exceeding for the third test case in given program
For finding prime for large test cases
@Himanshu-Sajwan-2271264282963988 The naive approach for generating the prime numbers will fail for large test cases in this problem. You have to try it using Sieve of Eratosthenes whose lecture videos are available in the Number Theory section of your course. Try this problem after referring that.