N is 10^5 : Do we need to calculate N^5 Prime Number?

Like in the ques max value of n is 10^5, So we need to calculate 10^5th prime number. How can this be done in Java without exceeding the number limits;

Hey @Jagrit in your course there is a topic sieve of Eratosthenes, I would suggest you to watch it to get a intuition of how will this work.

Also as you are asking for 10^5 , it can be calculated it’s just you have to know the concept of prime number to calculate. So it’s necessary to know that topic.

Using Sieve, I can calculate all the prime numbers from 1 to N^9 in Java. But will there be 10^5 primes there. This is confusing me.

If you can calculate prime till 10^9 then of course you can also calculate it using 10^5 by just changing value of N, right? If this is not your doubt then please elaborate it

No, man. In the question, they are asking nth prime number. Like if n = 1, I need to print 2. So I am asking if they give 10^5, I will need to print 10^5th prime number, which I don’t think will be among 1 to 10^9 numbers. This is my doubt.

I can calculate prime numbers from 1 to 10^9. This is not an issue. But will there be 10^5 prime numbers in this range? If not, then how I can calculate? Or Maybe the question statement is something else. Its not clear

OKay so i got your doubt, see value of 5x10^5 th prime number is 7,368,787 so you have to make sieve according to that.

And you got the question statement right it’s just you didn’t knew will the value lie in this range or not.

Ok. Understood. Thank you

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.