Nth prime number

Write codeMedium25 min

Your task

Return the nth prime number, 1-indexed (so the 1st prime is 2, the 6th is 13). Assume 1 <= n <= 10000. You do not know the value of the nth prime in advance, so you must size your sieve adaptively or grow it until you have collected enough primes.

Examples

nth_prime(n: int) -> int
Example 1
Inputnth_prime(6)
Output13