Unable to clear all testcases


what is the error in my code?

@goyalvivek you need to increae the range of numbers for that count given in the ques
Coding Blocks IDE
this is the changed code see if this works and if issue still exists let me know and if clear rate my experience

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.

Why does it not work with long long n = 600000; Its given in Constraints 1<=n<=500000?

hi @goyalvivek whats ur doubt?? i can see u have successfully submitted the code and and gained full points

yes i have cleared all the testcases but i am wondering why code as not working with size of array 600000 but worked with 900000 while the constrains were 1<=n<=500000?

u can declare the array globally

yes. but why was it not working with long long n = 600000; Its given in Constraints 1<=n<=500000?

@goyalvivek this range might not contain the no of primes asked in the question
n is the nth prime no if you take range=100 it dont means that there will be 100 prime numbers in range 1 to 100

ok, got it, thanks for ur help

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.