# Solving $n/\ln (n) = 990,000$

I need to solve the non-linear equation $$n/ \ln(n) = 990,000$$, which is the approximation of the $$990,000$$th prime number. This is what I tried:

$$n = 990,000 ( \ln (n))$$ (Multiply both sides by $$\ln(n)$$)

$$\frac{n}{990,000} = \ln(n)$$

$$e^{n/990,000} = e ^ {\ln(n)}$$

$$n = e^{n/990,000}$$

So then I went here: https://primes.utm.edu/nthprime/index.php#nth

And found the 990,000 prime number is: $$15,318,907$$

So I plugged that in for n:

$$990, 000\text{th prime} = e^{15,318,907/990000}$$

$$15,318,907 \neq 3803815.32$$

But clearly the numbers are not equal, I'm not sure what I've done wrong, or how to go about getting an approximate answer for $$n$$, I need to find the answer mathematically using that formula.

• $e^{15,318,907/990000}$ is not even close to $3803815.32$, it's more of a $5249500$. Anyway if you check the approximation before you took the exponential ($15318907/990,000 \approx \ln 15318907$) you can see it works quite well. Just the error increases after exponentiation...
– Sil
Feb 9, 2018 at 23:44
• Also, notice that you can use the prime number theorem to derive approximation formula for $n$-th prime (proofwiki.org/wiki/Approximate_Value_of_Nth_Prime_Number).
– Sil
Feb 9, 2018 at 23:58
• From comments on the answers, this is a case of the XY problem. You want an approximation to the nth prime (see this question: Is there a way to find the approximate value of the nth prime?). But your question is about a single potential solution. Feb 11, 2018 at 8:17

The solution to the equation ${n \over \ln n} = b$ is the Product Log or Lambert's W function, so for this problem $n\to -990000\ W_{-1}\left(\frac{-1}{990000}\right) \approx 1.64497 10^7$. The 990000th prime (found by common computer search) is $15318907 \approx 1.53 \times 10^7$.

• how did you go from 1.644 ^ 7 to 1.53 * 10 ^ 7?
– 0xI
Feb 9, 2018 at 23:48
• As in, how did you figure out the prime number here. Did I miss a step in your solution?
– 0xI
Feb 9, 2018 at 23:48
• I didn't go from $1.644 \times 10^7$ to $1.53 \times 10^7$. The solution to the nonlinear equation is merely an approximation. Of course no formula gives an exact value for a prime. (Whoever found such a formula would win a Field's Medal and change mathematics forever.) Feb 9, 2018 at 23:50
• So How would I get 1.53 x 10^7 if I didn't know the answer was 15318907?How would I find the approximate answer myself, without knowing the answer is 15318907.
– 0xI
Feb 9, 2018 at 23:51
• @rrrrrr, there are a variety of ways. Inverting the Riemann R function (e.g. binary search with R) is the most accurate -- it gives 15318519 for your example, which is quite close. You can also invert li (the logarithmic integral) with or without a second sqrt(n) term. You can average the upper and lower bounds from Dusart 2010, Axler 2013, or Axler 2017. You can use the Cipolla 1902 asymptotic formula. Feb 11, 2018 at 8:12

$n/\ln(n)=990,000$ is not a approximation of the 990,000th prime number!

If you define the function $\pi(n)$ which gives the number of primes less than or equal to $n$, then $$\pi(n)\sim \frac{n}{\ln(n)}$$

• How do I find the prime number using that function?
– 0xI
Feb 9, 2018 at 23:46
• Why do you think you can? Feb 9, 2018 at 23:46
• Because my assignment says I need to using n/ln (n) :/
– 0xI
Feb 9, 2018 at 23:47
• You assignment says to actually find the 990,000th prime number???? Feb 9, 2018 at 23:49
• Yep, we have to find it using that formula or a formula that's more efficient.
– 0xI
Feb 9, 2018 at 23:50

The prime counting function $\frac {n}{\ln n}$ says that there are about $\frac {n}{\ln n}$ prime numbers less than $n.$

so if you have say that there are $990,000$ prime numbers less than 15 odd million

Then we would hope to see that $\frac {15,318,907}{\ln (15,308,907)} \approx 990,000$

In fact:

$\frac {15,318,907}{\ln (15,308,907)} \approx 925,916$ giving about 7% error.

Which ties out with this table.

https://en.wikipedia.org/wiki/Prime-counting_function

• How do I get the 15million without using that site? I need to find the number using the formula, or some other formula.
– 0xI
Feb 9, 2018 at 23:47
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 11, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.853676438331604, "perplexity": 383.3003998848227}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-40/segments/1664030337404.30/warc/CC-MAIN-20221003070342-20221003100342-00539.warc.gz"}