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?