Associated Topics || Dr. Math Home || Search Dr. Math

### Degree of Error in pi(x) Approximation

```Date: 10/20/2004 at 10:36:31
From: Filippo
Subject: pi(x) approximation

How does the error in the formula x/ln(x) used to approximate pi(x)
(the primes counting function) behave by the growth of x?  I know that
it gets smaller, but is there a formula that, using x, expresses the
error on x/ln(x)?

I don't know anything else apart from Chebyshev limits, but they are
the limits for ANY value of x, and I needed to know the upper limit as
x grows...

I tried for about a week to search the internet for an answer, but I

```

```
Date: 10/21/2004 at 11:15:30
From: Doctor Vogler
Subject: Re: pi(x) approximation

Hi Filippo,

Thanks for writing to Dr. Math.  You can get a lot of information

Prime Number Theorem

First of all, you said that the error at estimating pi(x) by x/ln(x)
gets smaller when x gets bigger, but this is only partially true.  The
*relative* error gets smaller, but the *absolute* error gets bigger.
That means that

pi(x)
-------
x/ln(x)

goes to 1 as x goes to infinity, and this is called the Prime Number
Theorem.  But of the difference

pi(x) - x/ln(x)

this only says that it has order smaller than x/ln(x).  That is, it means

pi(x) = x/ln(x) + o(x/ln(x)).

Are you familiar with big-O and little-o notation?

If the Riemann Hypothesis is to be believed, then we have their
equation (21),

pi(x) = Li(x) + O(sqrt(x)*ln(x)),

where Li(x) is a smooth function (the logarithmic integral) which is
approximated by their equations (6) and (7),

Li(x) = x/ln(x) + x/(ln x)^2 + O(x/(ln x)^3)

Since the amount by which Li(x) differs from x/ln(x) is approximately

x/(ln x)^2,

and this is (asymptotically) much bigger than the error term between
pi(x) and Li(x), that means that

pi(x) - x/ln(x)

is approximately

x/(ln x)^2

for large x.  So Li(x) is really a much better approximation to pi(x),
and its error is probably as I stated above, though the proof depends
on the Riemann Hypothesis, which has not yet been proven.

back and show me what you have been able to do, and I will try to
offer further suggestions.

- Doctor Vogler, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 12/17/2004 at 07:10:44
From: Filippo
Subject: Thank you (pi(x) approximation)

Thanks for the time you spent to answer me, now that I studied
little-o and big-O notation I fully understand your answer; I hope to
go further on my personal conclusions, that obviously are o(what
mathematicians know)!

Thanks again.

- Filippo
```
Associated Topics:
College Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search