getting an error of time limit exceeded.
Little help with the code
You need to solve using efficient method brute force will not work.
Share your code for further help. 
@faizahmed2696 Hi, in addition to using a sieve, you have to precompute the primes as well. by precompute i mean computing the list of primes and storing them upto the given upper limit of constraints.
So first study about sieve if you donβt know, then refer my code below.
Precomputing is important!
Also if ya doubt is cleared mark it resolved and rate full!
Happy coding!
after applying sieve still getting TLE