# Inconsistent definitions of prime counting functions

In H. M. Edwards' book Riemann's Zeta Function on pages $$33–34$$ (chapter "Riemann's paper") it reads

Of course Riemann's goal was to obtain a formula not for $$J(x)$$ [explained below] but for the function $$\pi (x)$$, that is, for the number of primes less than any given magnitude $$x$$. [...] Riemann inverts this relationship [...] to obtain $$\pi (x)=\sum_{n\gt 0}\frac{\mu (n)}{n}J\left(x^{\frac{1}{n}}\right),$$ [...] the series [the one above] [...] when combined with the analytical formula for $$J(x)$$ $$J(x)=\operatorname{li}x-\sum_{\rho}\operatorname{li} x^{\rho}-\ln 2+\int_x^\infty \frac{dt}{t\left(t^2-1\right)\ln t},\, x\gt 1,$$ it gives an analytical formula for $$\pi (x)$$ as desired.

(mathematical notation slightly adjusted to match current conventions, though $$\pi (x)$$ and $$J(x)$$ were not changed)

Also, on page $$22$$, $$J(x)$$ is defined as $$J(x)=\frac{1}{2}\left(\sum_{p^n\lt x}\frac{1}{n}+\sum_{p^n\le x}\frac{1}{n}\right).$$

Even though Riemann elaborated on the number of primes less than a given magnitude, in modern mathematics, $$\pi (x)$$ denotes the number of primes less than or equal to a given magnitude. From Riemann's Ueber die Anzahl der Primzahlen unter einer gegeben Grösse:

[...] the number of primes that are smaller than $$x$$ can now be determined. Let $$F(x)$$ be equal to this number when $$x$$ is not exactly equal to a prime number, but let it be greater by $$\frac{1}{2}$$ when $$x$$ is a prime number, so that, for any $$x$$ at which there is a jump in the value in $$F(x)$$, $$F(x)=\frac{F(x+0)+F(x-0)}{2}.$$ [translated to English]

(note the obsolete notation for limits; also the $$F$$ in $$F(x)$$ should have been distinguished from the $$F$$ in $$F(x+0)$$)

Now, let's change the indices to make things clear. Let $$\pi (x)=\sum_{p\le x}1$$ be the prime counting function and $$J(x)=\sum_{p^n\le x}\frac{1}{n},$$ $$J_0 (x)=\frac{1}{2}\left(\sum_{p^n\lt x}\frac{1}{n}+\sum_{p^n\le x}\frac{1}{n}\right)\, (\text{that's Edwards'}\, J(x)),$$ $$\pi _0 (x)=\lim_{\varepsilon\to 0}\frac{\pi (x-\varepsilon)+\pi (x+\varepsilon)}{2}\, (\text{that's Edwards'}\, \pi (x)).$$ Then we have $$\pi _0 (x)=\sum_{n\gt 0}\frac{\mu (n)}{n}J_0 \left(x^{\frac{1}{n}}\right)$$ according to this Wikipedia article (https://en.wikipedia.org/wiki/Prime-counting_function). This, however, contradicts the Mathworld article on the same topic (https://mathworld.wolfram.com/PrimeCountingFunction.html):

A modified version of the prime counting function is given by \begin{align}\pi _0 (p)&\equiv\begin{cases}\pi (p) &\mbox{ }\text{for}\, p\, \text{composite}\\ \pi (p)-\frac{1}{2} &\mbox{ }\text{for}\, p\, \text{prime}\end{cases}\\ \pi _0(p)&=\sum_{n=1}^\infty \frac{\mu (x)f\left(x^{1/n}\right)}{n},\end{align} where $$\mu (n)$$ is the Möbius function and $$f(x)$$ is the Riemann prime counting function. [I think there should be $$\mu (n)$$ and $$f\left(p^{1/n}\right)$$ in the formula.]

The Riemann prime counting function is defined to be $$f(x)=\sum_{p^n\le x}\frac{1}{n}$$ but, looking at the formula Mathworld provides, that "$$f(x)$$" should be the same as $$J_0 (x)$$ mentioned before (which is not) and that's the contradiction. Even more confusingly, the Mathworld article on the Riemann prime counting function reads

Amazingly, the prime counting function $$\pi (x)$$ is related to $$f(x)$$ by the Möbius transform $$\pi (x)=\sum_{n=1}^\infty \frac{\mu (n)}{n}f\left(x^{1/n}\right),$$ [...] Riemann proposed that $$f(x)=\operatorname{li}(x)-\sum_{\rho}\operatorname{li}(x^{\rho})-\ln 2+\int_x^\infty \frac{dt}{t(t^2-1)},$$ [...] This formula was subsequently proved by Mangoldt.

That contradicts the Wikipedia article mentioned above which claims that $$J_0 (x)=\operatorname{li}(x)-\sum_{\rho}\operatorname{li}(x^{\rho})-\ln 2+\int_x^\infty \frac{dt}{t(t^2-1)},$$ but clearly $$\frac{1}{2}\left(\sum_{p^n\lt x}\frac{1}{n}+\sum_{p^n\le x}\frac{1}{n}\right)= \sum_{p^n\le x}\frac{1}{n}$$ is not true for every $$x$$.

What is true, then?

• Is the problem that different sources use different definitions? As long as they are both internally consistent, this shouldn't be a problem (other than it being slightly confusing and cumbersome to translate between the two). – Servaes Mar 25 '20 at 12:04
• The answer I posted to your related question at math.stackexchange.com/q/3595215 perhaps provides some insight. – Steven Clark Mar 26 '20 at 0:46

There are four errors in the formula in Mathworld's article on the prime counting function (https://mathworld.wolfram.com/PrimeCountingFunction.html). Instead of $$\pi _0 (p)\equiv\begin{cases}\pi (p) &\mbox{ }\text{for}\, p\, \text{composite}\\ \pi (p)-\frac{1}{2} &\mbox{ }\text{for}\, p\, \text{prime}\end{cases}$$ there should be $$\pi _0 (p)\equiv\begin{cases}\pi (p) &\mbox{ }\text{for}\, p\, \text{composite}\\ \pi (p)-1&\mbox{ }\text{for}\, p\, \text{prime}\end{cases}$$ And instead of $$\pi _0 (p)=\sum_{n=1}^\infty \frac{\mu (x) f\left(x^{1/n}\right)}{n}$$ there should be $$\pi (p)=\sum_{n=1}^\infty \frac{\mu (n) f\left(p^{1/n}\right)}{n}.$$
• I believe the first formula is correct. Whereas the function $\pi(x)$ is non-continuous and always takes a step of magnitude 1 at prime integers, the function $\pi_o(x)$ is continuous and always evaluates to $\pi_o(x)=\pi(x)−\frac{1}{2}$ at prime integers, or more generally $\pi_o(x)=\underset{\epsilon\to 0}{\text{lim}}\frac{\pi(x−\epsilon)+\pi(x+\epsilon)}{2}$ which is valid for all x>1. – Steven Clark Mar 26 '20 at 16:01
• I believe the second formula should have been $\pi_o(x)=\sum\limits_{n=1}^\infty\frac{\mu(n)}{n}f(x^{1/n})$ which is valid for all $x>1$ (including non-integer as well as integer values of $x>1$) assuming $f(x)$ is Riemann's explicit formula for $J(x)=\sum\limits_{p^k\le x}\frac{1}{k}$ which only converges for $x>1$. – Steven Clark Mar 26 '20 at 16:06