I need to estimate count of primes in the range $[n..m)$, where $n < m$, $n \in N$ and $m \in N$ and this estimation must always exceed the actual count of primes in the given range (i.e. be an upper bound).
The simple but ineffective solution would be just $m - n$, though it is fine when $m$ is close to $n$.
An accurate estimation would look as $[Li(m) - Li(n)]$ according to the Riemann formula for $\pi(x)$ but I believe I can't use it for upper bound.
So the questions is: how can I estimate this upper bound effectively enough (i.e. by using relatively simple calculations)?
If giving such an approximation is hard for $[n..m)$, may be some simple method exists for upper bound for the range $(1..m)$?
One way to do it would be the following.
The exact number of primes below a given number $x$ is given by the prime counting function, denoted as $\pi(x)$. For example, $\pi(10) = 4$ and $\pi(20) = 8$. However, to find $\pi(x)$ it is required to count the number of primes explicitly, which is cumbersome.
Wikipedia informs me the following inequality:
$$\frac{x}{\ln x} < \pi(x) < 1.25506\frac{x}{\ln x}$$
Therefore the number of primes between $m$ and $n$ with $m > n$ is
$$\pi(m) - \pi(n) < 1.25506\left(\frac{m}{\ln m} - \frac{n}{\ln n}\right)$$
which is a much easier computation than, say, $\operatorname{Li}(x)$. This is not a rigorous argument but numerical evidence shows that the bound is fairly accurate.
Caveat: Be warned that this bound can fail if $m$ and $n$ are too close. You might want to experiment with different values of $m$ and $n$ and perhaps adjust the bound in one way or another if, say, $m - n$ is smaller than a threshold value.
EDIT: An alternative upper bound would be
$$1.25506\frac{m}{\ln m} - \frac{n}{\ln n}, \quad n > 17$$
which is safer to use, but much more inaccurate.