# Logarithmic integral function

The logarithmic integral is the special function defined for real \( x > 1 \) as the Cauchy principal value

\[ \mathrm{li}(x) = \int_{0}^{x} \frac{dt}{\ln t}, \]

where the singular behavior of \( 1/\ln t \) at \( t = 1 \) is handled by taking the limit of integrals that stop just short of 1 on each side<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup><sup> • </sup><sup>[2](https://dlmf.nist.gov/6.2)</sup>. It is one of the first transcendental functions encountered after the trigonometric and logarithmic functions: the integral of \( \ln t \) from 1 to \( x \) has the closed form \( x\ln x - x \), but the integral of \( 1/\ln t \) admits no expression in elementary functions, and the new function \( \mathrm{li}(x) \) is introduced to name it<sup>[3](https://jordanbell.info/LaTeX/historical/li/)</sup>. Its main role in mathematics is as the standard approximation to the prime counting function \( \pi(x) \), the number of primes not exceeding \( x \)<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup>.

| Key fact | Detail |
|---|---|
| Definition | \( \mathrm{li}(x) = \mathrm{PV}\!\int_0^x dt/\ln t \) for \( x > 1 \), with a singularity at \( x = 1 \); \( \mathrm{li}(0) = 0 \), \( \mathrm{li}(1) = -\infty \)<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup><sup> • </sup><sup>[2](https://dlmf.nist.gov/6.2)</sup> |
| Relation to Ei | \( \mathrm{li}(x) = \mathrm{Ei}(\ln x) \), where \( \mathrm{Ei} \) is the exponential integral; derivative \( d\,\mathrm{li}(z)/dz = 1/\ln z \)<sup>[2](https://dlmf.nist.gov/6.2)</sup><sup> • </sup><sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup> |
| Offset form | The prime number theorem uses \( \mathrm{Li}(x) = \int_2^x du/\ln u = \mathrm{li}(x) - \mathrm{li}(2) \), so that \( \mathrm{Li}(2) = 0 \)<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup> |
| Soldner's constant | \( \mu = 1.4513692348\ldots \) is the unique positive number with \( \mathrm{li}(\mu) = 0 \); \( \mathrm{li}(2) = 1.0451637801174\ldots \)<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup> |
| Prime number theorem | \( \pi(x) \sim \mathrm{Li}(x) \), proved independently by Hadamard and de la Vallée Poussin in 1896<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup> |
| Asymptotic series | \( \mathrm{Li}(n) \sim \sum_{k=0}^{\infty} k!\,n/(\ln n)^{k+1} = n/\ln n + n/(\ln n)^2 + 2n/(\ln n)^3 + \cdots \)<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup> |
| Sign changes | \( \pi(x) - \mathrm{li}(x) \) changes sign infinitely often (Littlewood, 1914); rigorous work proves that some \( x \) in \( [1.39792101 \times 10^{316},\ 1.39847603 \times 10^{316}] \) satisfies \( \pi(x) > \mathrm{li}(x) \), without establishing the first crossover<sup>[5](https://mathworld.wolfram.com/SkewesNumber.html)</sup><sup> • </sup><sup>[12](https://eprints.maths.manchester.ac.uk/106/)</sup> |

## Definition and basic properties

The integrand \( 1/\ln t \) blows up at \( t = 1 \), so for \( x > 1 \) the integral is understood as a Cauchy principal value, the limit of integrals over \( [0, 1-\epsilon] \) and \( [1+\epsilon, x] \) as \( \epsilon \to 0 \)<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>. Special values include \( \mathrm{li}(0) = 0 \), \( \mathrm{li}(1) = -\infty \), and \( \mathrm{li}(2) = 1.0451637801174\ldots \)<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>. There is a unique positive number at which the function vanishes,

\[ \mu = 1.4513692348\ldots, \]

called Soldner's constant, so that for \( x > \mu \) the function can be written \( \mathrm{li}(x) = \int_\mu^x dt/\ln t \)<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>.

The logarithmic integral is not an independent function in the computational sense: it is the [exponential integral](https://www.edgepedia.org/exponential-integral) evaluated at the logarithm of its argument,

\[ \mathrm{li}(x) = \mathrm{Ei}(\ln x), \]

where \( \mathrm{Ei}(x) = \int_{-\infty}^{x} e^t/t \, dt \) taken as a principal value for \( x > 0 \)<sup>[2](https://dlmf.nist.gov/6.2)</sup><sup> • </sup><sup>[6](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.expi.html)</sup>. Its derivative is \( 1/\ln z \), and the definition extends to the complex plane<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>. Nielsen showed, and [Srinivasa Ramanujan](https://www.edgepedia.org/srinivasa-ramanujan) independently discovered, the convergent expansion

\[ \mathrm{li}(x) = \gamma + \ln\ln x + \sum_{k=1}^{\infty} \frac{(\ln x)^k}{k!\,k}, \]

with \( \gamma \) the [Euler–Mascheroni constant](https://www.edgepedia.org/euler-mascheroni-constant)<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>.

## Two conventions: li and Li

Two offset conventions coexist. The "American" definition is the principal-value integral from 0, implemented in the [Wolfram Language](https://www.edgepedia.org/wolfram-language) as `LogIntegral[x]`<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>. The form appearing in the prime number theorem, sometimes called the "European" definition and used for example by [Edmund Landau](https://www.edgepedia.org/edmund-landau), is shifted so that it vanishes at 2:

\[ \mathrm{Li}(x) = \int_2^x \frac{du}{\ln u} = \mathrm{li}(x) - \mathrm{li}(2). \]

The two differ by the constant \( \mathrm{li}(2) \approx 1.045 \), which is negligible for the large arguments at which the function is used in prime counting<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>. The notation \( \mathrm{Li}_n(z) \) is also used, confusingly, for the polylogarithm<sup>[1](https://mathworld.wolfram.com/LogarithmicIntegral.html)</sup>.

## Role in the prime number theorem

The prime counting function \( \pi(x) \) counts the primes not exceeding \( x \)<sup>[7](https://dlmf.nist.gov/27.2)</sup>. In 1792, at age 15, [Carl Friedrich Gauss](https://www.edgepedia.org/carl-friedrich-gauss) proposed that \( \pi(n) \sim n/\ln n \), and later refined his estimate to \( \pi(n) \sim \mathrm{Li}(n) \)<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup>. Gauss did not publish this work; he first described it in an 1849 letter to the astronomer Johann Franz Encke, reporting that as early as 1792 or 1793 he had conjectured that the number of primes below a bound \( n \) was \( \int dn/\log n \), and the letter was published posthumously in 1863<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup><sup> • </sup><sup>[8](https://old.maa.org/node/1732760)</sup>. [Adrien-Marie Legendre](https://www.edgepedia.org/adrien-marie-legendre), unaware of Gauss's private work, published his own guess, first in 1798 and in 1808 in the form \( \pi(n) \sim n/(\ln n + B) \) with \( B = -1.08366 \), a value now called Legendre's constant; the formula is correct in the leading term only<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup>.

An elementary integration by parts shows \( \mathrm{Li}(x) \) is asymptotically equal to \( x/\ln x \), so the Gauss and Legendre conjectures are both equivalent to the statement now known as the prime number theorem, \( \pi(x) \sim \mathrm{Li}(x) \)<sup>[9](https://calteches.library.caltech.edu/3832/)</sup>. The theorem was first proved in 1896, independently by [Jacques Hadamard](https://www.edgepedia.org/jacques-hadamard) and [Charles-Jean de la Vallée Poussin](https://www.edgepedia.org/charles-jean-de-la-vallee-poussin)<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup><sup> • </sup><sup>[7](https://dlmf.nist.gov/27.2)</sup>.

**Accuracy in practice.** The logarithmic integral is a markedly better estimate than \( x/\ln x \). In the table Gauss sent Encke, based on prime counts up to 3 million, the relative error of \( \mathrm{Li}(x) \) was between 0.10 and 0.16 percent at every tabulated point; for example at \( x = 3{,}000{,}000 \) the true count is 216,745 and \( \mathrm{Li}(x) \) gives 216,970.6<sup>[9](https://calteches.library.caltech.edu/3832/)</sup>. A 2013 analysis explains the advantage structurally: \( \mathrm{li}(x) \) arises as a continuum approximation of a sieve over intervals between consecutive prime squares, whereas \( x/\ln x \) corresponds to sieving repeatedly in regions already completed, which is why it underestimates \( \pi(x) \)<sup>[10](https://arxiv.org/abs/1311.1093)</sup>.

The asymptotic expansion about infinity,

\[ \mathrm{Li}(n) \sim \sum_{k=0}^{\infty} \frac{k!\,n}{(\ln n)^{k+1}}, \]

gives \( n/\ln n + n/(\ln n)^2 + 2n/(\ln n)^3 + \cdots \), and taking the first three terms has been shown to be a better estimate than \( n/\ln n \) alone<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup>.

## The sign of π(x) − li(x)

For all small \( n \) that were ever checked, \( \pi(n) < \mathrm{Li}(n) \), and prominent mathematicians including Gauss and [Bernhard Riemann](https://www.edgepedia.org/bernhard-riemann) conjectured the inequality was strict. [John Edensor Littlewood](https://www.edgepedia.org/john-edensor-littlewood) refuted this in 1914, proving that \( \pi(x) - \mathrm{li}(x) \) changes sign infinitely often<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup>. Stanley Skewes showed in 1933 that, assuming the [Riemann hypothesis](https://www.edgepedia.org/riemann-hypothesis), the first crossing occurs before \( 10^{10^{10^{34}}} \), a bound since reduced to below \( 1.39822 \times 10^{316} \) by Bays and Hudson in 2000; a proposed numerical location near \( 1.397162914 \times 10^{316} \) has been suggested by Patrick Demichel<sup>[5](https://mathworld.wolfram.com/SkewesNumber.html)</sup><sup> • </sup><sup>[12](https://eprints.maths.manchester.ac.uk/106/)</sup>. Rigorous lower bounds are also known: Rosser and Schoenfeld proved in 1962 that there are no crossovers below \( 10^8 \), improved to \( 10^{14} \) by Kotnik in 2008<sup>[5](https://mathworld.wolfram.com/SkewesNumber.html)</sup>. Earlier, Pafnuty Chebyshev had shown for large \( n \) that \( 0.89\,\mathrm{Li}(n) < \pi(n) < 1.11\,\mathrm{Li}(n) \)<sup>[4](https://mathworld.wolfram.com/PrimeNumberTheorem.html)</sup>.

## Computation

Because \( \mathrm{li}(x) = \mathrm{Ei}(\ln x) \), numerical libraries evaluate it through the exponential integral. SciPy provides `scipy.special.expi`, implementing \( \mathrm{Ei} \) with a Cauchy principal value for positive arguments and analytic continuation to the complex plane<sup>[6](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.expi.html)</sup>. A survey of numerical evaluation of special functions lists the logarithmic integral of real argument among the routines available in comprehensive libraries such as IMSL, SLATEC, and Scientific Desk<sup>[11](https://math.nist.gov/nesf/Sect4-3/Sect4-3.html)</sup>.

## References

1. [Weisstein, Eric W. "Logarithmic Integral." MathWorld](https://mathworld.wolfram.com/LogarithmicIntegral.html)
2. [DLMF §6.2, Definitions and Interrelations, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/6.2)
3. [Bell, Jordan (2016). The logarithmic integral](https://jordanbell.info/LaTeX/historical/li/)
4. [Weisstein, Eric W. "Prime Number Theorem." MathWorld](https://mathworld.wolfram.com/PrimeNumberTheorem.html)
5. [Weisstein, Eric W. "Skewes Number." MathWorld](https://mathworld.wolfram.com/SkewesNumber.html)
6. [scipy.special.expi, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.expi.html)
7. [DLMF §27.2, Functions, Multiplicative Number Theory, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/27.2)
8. [The Origin of the Prime Number Theorem: A Mini-Primary Source Project, Mathematical Association of America](https://old.maa.org/node/1732760)
9. [A Centennial History of the Prime Number Theorem, Engineering & Science (Caltech), No. 4, 1996](https://calteches.library.caltech.edu/3832/)
10. [Tunstrøm, Kolbjørn (2013). The origin of the logarithmic integral in the prime number theorem. arXiv:1311.1093](https://arxiv.org/abs/1311.1093)
11. [Lozier, D. W. and Olver, F. W. J. Numerical Evaluation of Special Functions, §4.3](https://math.nist.gov/nesf/Sect4-3/Sect4-3.html)
12. [A new bound for the smallest x with \pi(x) > \li(x) - MIMS EPrints](https://eprints.maths.manchester.ac.uk/106/)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Numbers and algebra › Number theory › Analytic number theory › Zeta and L-functions › Explicit formulas and prime counting*

*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
