I am not able to sopt the error

we need to find the nth prime number using sieve

hello @tAkshat
ur sieve size is not big enough to find 500 000 th prime number.

first check value of 500 000 th prime number and prepare a sieve upto that and store all prime till that in ur prime array

rest is correct in ur code

i am still getting error now that i have modified the code

assuming 500000th prime to be in a range greater than 10^7 i have increased the range of p[] to 10^8

@tAkshat
now the size of sieve is too big , u cant allocate that much memory.
value of 500 000 th prime number is 7,368,787

now prepare sieve upto this only and then try

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.