Query in Deepak and Primes

Only the two test cases are not being passed. I’ve applied sieve of erastosthenes optimised approach.
Here is the code

Hello @ratulhans,

You have raised the doubt for modulo-properties.
It’s heading is Problem in Deepak and Primes.
And the code that you have sent is of some other question.

Can you please, specify the correct Problem name?

Ohh I’m extremely sorry. Here is the code


Question https://hack.codingblocks.com/contests/c/925/700

Hello @ratulhans,

As it is mentioned in the question that you have to find nth prime number and
n can be equal to 5000000.

So, considering this in mind can you find the nth prime number by iterating the loop upto 5000000
for(i=3;i<n;i=i+2){}…?

The code you are running is used for the case, when you are given a number and you have to check if that number is prime or not.

It is obvious that for m=5000000, you have to iterate the loop for more than 5000000 times.
100000005 would work. which is almost double.

Hope, this would help.
Give a like, if you are satisfied.

I’ve made the necessary change, but now it is giving run error.
Plz reply.It’s urgent.

I apologize for replying late. I was busy in some stuff.
Can you share your code?

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.