Prime number theorem is a statement that we have $$\lim_{x \to +\infty} \dfrac {\pi(x)}{\dfrac{x}{\ln(x)}}=1$$.
What has logarithm to do with number of prime numbers less than or equal to a given number and why of all the functions that could be there we have exactly $\ln(x)$?
It could be that there is something mysterious in this limit relationship not obvious at all, can someone tell me more?
For me, it is not at all obvious that asymptotically function $\pi(x) \cdot \ln(x)$ will grow almost exactly as $x$, one continuous and other discontinuous.
Let $p_i$ be the $i$th prime. Then the product:
$$\prod_{i=1}^{n}\left(1-\frac{1}{p_i}\right)$$
is the density of numbers that are not divisible by any $p_i,$ $i=1,\dots, n.$
This can be rewritten:
$$\frac{1}{\sum_{m=1}^{\infty} \frac{f(m)}{m}}$$ where $$f(m)=\begin{cases}1&m\text{ has only the }p_1,\dots,p_n\text{ as prime factors}\\ 0&\text{otherwise} \end{cases}$$
Note that, $f(m)=1$ for all $m<p_{n+1}.$
The key is then that $\sum_{m=1}^x\frac{1}{m}\approx \log x$.
How we formalize this is, of course, quite complicated, or we'd have a really easy proof of the prime number theorem.