Connect via MCP →

Enter Calculation

Dimensionless real number, x > 0 and x ≠ 1 for a finite value.

Formula

Advertisement

Results

Logarithmic Integral li(x)
1.0451637801
li(2)
Input x 2
Method li(x) = Ei(ln x) via convergent series

What is the logarithmic integral li(x)?

The logarithmic integral function, written \(\operatorname{li}(x)\), is a special function defined as the integral of \(1/\ln(t)\) from 0 to x. It appears throughout analytic number theory, most famously as the leading-order approximation to the prime-counting function \(\pi(x)\) in the Prime Number Theorem: the number of primes below x is approximately \(\operatorname{li}(x)\). Because the integrand has a pole at t = 1, for x > 1 the integral is interpreted as a Cauchy principal value, which is the standard definition.

Graph of 1 over ln t with shaded area representing the logarithmic integral up to x
li(x) is the shaded area under the curve 1/ln(t), with a singularity at t = 1.

How to use this calculator

Enter any real value x with x > 0 and x ≠ 1. The calculator returns \(\operatorname{li}(x)\) to full double precision (about 15 significant figures). Values of x between 0 and 1 give a finite negative result; \(\operatorname{li}(0) = 0\) and \(\operatorname{li}(1) = -\infty\) (reported as undefined). For x ≤ 0 the real-valued li is undefined.

The formula explained

This tool uses the identity \(\operatorname{li}(x) = \operatorname{Ei}(\ln x)\), where Ei is the exponential integral. With \(u = \ln(x)\) and the Euler-Mascheroni constant \(\gamma = 0.5772156649\), we evaluate the convergent series $$\operatorname{li}(x) = \int_{0}^{x} \frac{dt}{\ln t} = \gamma + \ln\!\left|\ln x\right| + \sum_{k=1}^{\infty} \frac{(\ln x)^{k}}{k \cdot k!}$$ The series converges for every real u not equal to 0 and is summed until each term is below about \(10^{-18}\) of the running total.

Advertisement
Comparison of the prime counting function and the logarithmic integral curves
li(x) closely approximates the prime-counting function pi(x).

Worked example

For x = 2: \(u = \ln(2) = 0.6931472\), \(\ln|u| = -0.3665129\), and the series sums to about \(0.8344608\). Adding gamma gives $$\operatorname{li}(2) = 0.5772157 - 0.3665129 + 0.8344608 = 1.04516378$$ matching the known reference value \(1.0451637801\).

FAQ

Why is li(1) infinite? The integrand \(1/\ln(t)\) blows up as t approaches 1 from above, so \(\operatorname{li}(x)\) tends to negative infinity at x = 1.

Where does li(x) equal zero? At the Ramanujan-Soldner constant, \(x \approx 1.4513692349\).

Is li(x) the same as Li(x)? The offset version \(\operatorname{Li}(x) = \operatorname{li}(x) - \operatorname{li}(2)\) is sometimes used so that \(\operatorname{Li}(2) = 0\); this calculator returns the unoffset \(\operatorname{li}(x)\).

Last updated: