Prateek loves candy

sir though it passed all the test cases but i have a doubt . here in constraints it is given that ans is less than equal to 1e6 which means that we need to find prime numbers less than equal to 1e6 . so shouldn’t prime sieve should have size greater than 1e6 so that we can find 1e6 th prime number.

@gulatigarvita08 yes you’ll need to change the sieve size according to the nth prime number.

what should be the size of sieve then?? i took it as 1e8 and it showed tle.

@gulatigarvita08 this question has different constraints. Theoretically speaking you will need a bigger sieve for bigger prime numbers. But it is not practical to make such a big sieve so we use other methods instead. You’ll learn more about them later.