Prime Visit code

getting run error and 2 test cases are not correct

@shubhamkumarsingh the logic that you are using should not pass the tests. You should first store all the primes using a sieve of Eratosthenes and then binary search for the position of A and B in that list. Report their difference as the answer.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

can’t pass all test cases

Please post your code then

you still aren’t using binary search , you are linearly iterating which won’t pass time limits.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.