Counting the number of positive integers ($n(x)$) below a certain number x, is obviously simple and trivial: it is just $x$, however only when $x$ is an integer.

In the logarithmic prime counting function $\psi(x) = x - \log(2\pi) - \frac12 \log(1- \frac{1}{x^2}) - \sum_{\rho} \dfrac{x^{\rho}}{\rho}$, a constant (first term), the infinite sum of trivial zeros (middle term) and the infinite sum of non-trivial zeros (last term) of $\zeta(s)$, nicely account for the gaps between $x$ and $\psi(x)$. This annihilates the approximation errors of $\psi(x)$ at the integers, but also between them and induces the required prime step-function.

I wondered if a similar 'bottom up' formula exists, i.e. involving the infinite sums of (complex) zeros (call them $\mu$) of a function. Such formula would then look like: $n(x) = x - c - \sum_{\mu} \dfrac{x^{\mu}}{\mu}$. At the integers it obviously needs to be zero, but between the integers it needs to sum up an infinite amount of sine waves that then culminates into the saw tooth pattern in the graph below. enter image description here

Does such a function exist? And if so, could it be extended towards counting e.g. only even or only odd numbers?


The formula for the sawtooth wave in the graph above is easy to derive and is:

$$\displaystyle saw(x):=\frac12 - \frac{1}{\pi} \sum_{n=1}^{\infty} \frac{\sin(2nx\pi)}{n}= \frac12 +\frac{i}{2\pi}\ln(e^{-2\pi i (x-\frac12)})$$

However, this does not yet allow me to express $n(x)$ into an infinite sum involving (complex) zeros.

  • $\begingroup$ Have you heard of a function's Fourier series? $\endgroup$ Aug 15, 2013 at 16:56
  • $\begingroup$ Yes, I have. And with the sum of sinuses I was hinting at using that (similar to how the prime counting function has been constructed using Fourier analysis). I can express the sawtooth as a sum of sinuses, however can't make the final loop towards expressing these in (infinite sums of) zeros. $\endgroup$
    – Agno
    Aug 15, 2013 at 17:49
  • $\begingroup$ I suppose by sinuses you mean sinusoids? Interesting terminology. At any rate, I'll see if such a final loop can be made. $\endgroup$ Aug 15, 2013 at 17:54
  • $\begingroup$ Ouch. Sinusoids it is! I accidentally used a Dutch-ish plural for the sine and please be assured that I was not in any way thinking about an infinite sum of air cavities in the cranial bones... ;-) $\endgroup$
    – Agno
    Aug 15, 2013 at 19:35
  • $\begingroup$ Hahaha that's okay, mijn Nederlands is slecht. Anyway, I haven't gotten around to writing it, but I was thinking of grouping all the terms together from the Taylor-series expansion for $\frac1n\sin(2\pi n x)$ and seeing if anything nice comes out of it. $\endgroup$ Aug 15, 2013 at 20:06

1 Answer 1


Think I have found an answer. Not entirely perfect, however I find it quite satisfactory.

I firstly rewrote $\sin(x2\pi n)$ in the sawtooth-function:

$$\displaystyle saw(x):=\frac12 - \frac{1}{\pi} \sum_{n=1}^{\infty} \frac{\sin(x2\pi n)}{n}$$

into its Weierstrass product, which gives:

$$\displaystyle saw(x):=\frac12 - 2x \sum_{n=1}^{\infty} \prod_{k=1}^{\infty}\left( 1- \frac{4n^2x^2}{k^2}\right)$$

This can in turn be written as:

$$\displaystyle saw(x):=\frac12 - \sum_{n=1}^{\infty} \left(\frac{e^{x 2\pi ni}} {2 n \pi i}+\frac{e^{-x 2 \pi ni}} {-2 n \pi i}\right)$$

This looks already quite close to the structure I am after. However, I still need to find a function that has $\mu_n = 2 \pi ni$ and $\overline{\mu_n} =-2 \pi ni$ as its symmetrically paired roots.

I know that the following Hadamard product is true:

$$\displaystyle \xi_{int}(\frac{s}{2 \pi}) = \xi_{int}(0) \prod_{n=1}^\infty \left(1- \frac{s}{2 \pi ni} \right) \left(1- \frac{s}{{-2 \pi ni}} \right) $$

where $\xi_{int}(s) = \frac{\sinh(\pi s)}{s}$ and $\xi_{int}(0)=\pi$. So this gives:

$$\displaystyle \xi_{int}(s) = \frac{ 2 \pi \sinh \left(\dfrac{s}{2}\right) }{s}$$

Putting it all together this establishes the outcome I need:

$$\displaystyle saw(x):=\frac12 - \sum_{n=1}^{\infty} \left(\frac{e^{x \mu_n}} {\mu_n}+\frac{e^{x \overline{\mu_n}}} {\overline{\mu_n}}\right)$$

with $\mu_n$ and $\overline{\mu_n}$ being the paired complex roots of $\xi_{int}(s)$.

And the integer-counting function follows (very similar to the prime-counting function):

$$n(x):= x-\frac12 + \sum_{n=1}^{\infty} \left(\frac{e^{x \mu_n}} {\mu_n}+\frac{e^{x \overline{\mu_n}}} {\overline{\mu_n}}\right)$$

Here is a graphical illustration ($s$ is a complex number in the left graph):

enter image description here

The result can generalized for all (also non-integer) multiples. Let $l \in \mathbb{R}$ and assume $l=1 \rightarrow x=1,2,3...$, $l=2 \rightarrow x=2,4,6...$, $l=\sqrt{3} \rightarrow x=\sqrt{3},2\sqrt{3},3\sqrt{3}...$,etc. Then the generic multiple counting function becomes:

$$\displaystyle n(x,l):= \frac{x}{l}-\frac12 + \sum_{n=1}^{\infty} \left(\frac{e^{\dfrac{x \mu_n}{l}}} {\mu_n}+\frac{e^{\dfrac{x \overline{\mu_n}}{l}}} {\overline{\mu_n}}\right)$$

where $\mu_n$ and $\overline{\mu_n}$ are the n-th pair of complex roots of:

$$\displaystyle \xi_{int}(s,l) = \frac{ 2 \pi \sinh \left(\dfrac{ls}{2}\right) }{s}$$

For completeness' sake I also list the closed form for this counting function:

$$\displaystyle n(x,l):= \frac{x}{l}-\frac12 - \frac{i}{2 \pi} \ln \left(e^{-2\pi i(\frac{x}{l}-\frac12)} \right)$$

Now the only remaining question is where the constant $\frac12$ originates from. Tried already $\dfrac{\xi_{int}'(0)}{\xi_{int}(0)}$, similar to the prime counting function, but no success yet.

  • $\begingroup$ Hmm how can $n(x,l)$ be expressed by an elementary analytic function when it is used to describe a non-continuous function ? $\endgroup$
    – mick
    Jan 1, 2015 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.