section_path: Applications/Number theory
section_name: Number theory
paragraph_text: Number theory
  
  Natural logarithms are closely linked to counting prime numbers (2, 3, 5, 7, 11,...), an important topic in number theory. For any integer x, the quantity of prime numbers less than or equal to x is denoted π (x). The prime number theorem asserts that π (x) is approximately given by x ln (x), {\displaystyle {\frac {x}{\ln(x)}},} in the sense that the ratio of π (x) and that fraction approaches 1 when x tends to infinity. As a consequence, the probability that a randomly chosen number between 1 and x is prime is inversely proportional to the number of decimal digits of x. A far better estimate of π (x) is given by the offset logarithmic integral function Li(x), defined by L i (x) = ∫ 2 x 1 ln (t) d t. {\displaystyle \mathrm {Li} (x)=\int _{2}^{x}{\frac {1}{\ln(t)}}\,dt.} The Riemann hypothesis, one of the oldest open mathematical conjectures, can be stated in terms of comparing π (x) and Li(x). The Erdős–Kac theorem describing the number of distinct prime factors also involves the natural logarithm.
  
  The logarithm of n factorial, n ! = 1 · 2 ·... · n, is given by ln (n !) = ln (1) + ln (2) + ⋯ + ln (n). {\displaystyle \ln(n!)=\ln(1)+\ln(2)+\cdots +\ln(n).} This can be used to obtain Stirling's formula, an approximation of n ! for large n.