TITLE: An integer counting function n(x)
QUESTION [9 upvotes]: 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.

Does such a function exist? And if so, could it be extended towards counting e.g. only even or only odd numbers?
EDIT:
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.

REPLY [7 votes]: 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):

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.