I'm writing a program that finds the nth prime number, so if n was 10, the answer would be 29. I need to find an upper bound to search through though so if n was 10, the upper bound would be 30 (or any number before the next prime number which is 31).
Any ideas?
The number of primes below a given number, $\pi(x)$ can be estimated by:
$\pi(x) \approx \frac{x}{\ln(x)}$.
If you can find a "good" way to invert that function (and add maybe 20% uncertainty in there for small numbers), you can find the estimated upper bound.