#291 · Math · Intermediate · 65 XP · about 12 min
The primes in order are 2, 3, 5, 7, 11, 13, ... so 2 is the 1st prime and 13 is the 6th.
Write nth_prime(n) that returns the nth prime number, counting from 1.
nth_prime(1) # returns 2 nth_prime(6) # returns 13 nth_prime(100) # returns 541
You do not know in advance how far to search. A useful fact: for every n >= 6, the nth prime is smaller than n * (ln n + ln ln n), where ln is math.log.
First solves only, ranked by stars and then time.