## How can solve for sqrt(n)/ln(sqrt(n)) = x, for n? What must n be given some number x? [closed]

I'm wanting to write a computer program using Python that involves prime numbers. It will ask the user for the i^th prime he/she would like to find. For example, if i = 7, it would return 17 (17 is the 7th prime number), for i = 23 it would be 83 (83 is the 23rd prime number). I would like to do this for i in range(1,1000). I was thinking I could use the approximation sqrt(n)/ln(sqrt(n)) within the program. Given some i, the program could generate a range(2,n) and start checking for primality of numbers within that range. Each m in (2,n) that is prime would be given an index i and the program would continue to run until i = "user input number". When i="user input number" it would return the m in (2,n) assigned to that particular index i. So how can I solve for (or approx.) n in the expression: sqrt(n)/ln(sqrt(n)) = x? Or is there a much easier and better way to go about doing this? I'm just starting to learn programming using the MIT OpenCourseWare site. This isn't for school. It's just for the fun of it! Any suggestions?

-
If i were less than a million and I had reasonable hardware, I would do one of two things: implement a lookup table to give the primes directly, or implement a byte array with byte j being the difference between the (j+1)st and jth prime. Unless you have very limited resources, either a lookup table or summing differences will be about as fast as using a simple sieve implementation and counting up to the ith prime. Gerhard "Ask Me About System Design" Paseman, 2011.10.20 – Gerhard Paseman Oct 20 2011 at 18:55