This question is related to analytic formulas for $a(n)$ where $f_a(x)$ and $F_a(s)$ defined in formulas (1) and (2) below are the summatory function and Dirichlet series associated with $a(n)$.
$$f_a(x)=\sum\limits_{n=1}^x a(n)\tag{1}$$
$$F_a(s)=s\int\limits_0^\infty f_a(x)\,x^{-s-1}\,dx=\sum\limits_{n=1}^\infty a(n)\ n^{-s}\tag{2}$$
In the remainder of this question $\tilde{a}(x)$ is used to refer to an analytic representation of the arithmetic function $a(n)$. The analytic representation $\tilde{a}(x)$ typically converges to $a(n)$ when $|x|=n\in\mathbb{Z}_{\ne 0}$, but $\tilde{a}(0)$ may or may not converge to $a(0)$ when $a(0)$ is defined and meaningful.
The following two analytic formulas for $\tilde{a}(x)$ are based on An Exact Formula for the Prime Counting Function, where the only difference between the two formulas is formula (4) starts the inner series at $j=1$ instead of $j=0$. Formulas (3) and (4) below are both indeterminate at $x=0$ (because $0^0$ is indeterminate) but they converge at $x=0$ in a limit sense. I'll note that formulas (3) and (4) are both extremely slow to converge and extremely sensitive to evaluation precision, and formula (4) generally diverges faster (at a smaller magnitude of $x$) than formula (3) when both formulas are evaluated at the same limit $I$.
$$\tilde{a}(x)=\underset{I\to\infty}{\text{lim}}\left(-2\sum\limits_{i=0}^I (-1)^i (2 \pi x)^{2 i} \sum\limits_{j=0}^i \frac{(-1)^j (2 \pi)^{-2 j} F_a(2 j)}{(2 i-2 j+1)!}\right)\tag{3}$$
$$\tilde{a}(x)=\underset{I\to\infty}{\text{lim}}\left(-2\sum\limits_{i=0}^I (-1)^i (2 \pi x)^{2 i} \sum\limits_{j=1}^i \frac{(-1)^j (2 \pi)^{-2 j} F_a(2 j)}{(2 i-2 j+1)!}\right)\tag{4}$$
I believe in some cases the analytic formula for $\tilde{a}(n)$ defined in formula (5) below may be related or equivalent to the analytic formulas defined in formulas (3) and (4) above. The analytic function $\tilde{a}(x)$ defined in formula (5) evaluates exactly to $a(n)$ when $x=n\in\mathbb{Z}\land0<|n|\le N$. When formulas (3) and (4) above converge for a particular definition of $a(n)$, there are at least two conditions related to the evaluation limit $N$ in formula (5) below that are necessary, but perhaps not sufficient, to achieve this equivalence which are discussed following formula (5) below.
$$\tilde{a}(x)=\underset{N\to\infty}{\text{lim}}\left(\sum\limits_{n=1}^N\frac{b(n)}{n}\sum\limits_{k=1}^n\cos\left(\frac{2 \pi k x}{n}\right)\right)\quad\text{where}\quad b(n)=\sum\limits_{d|n}a(d)\,\mu\left(\frac{n}{d}\right)\tag{5}$$
Condition (1): The first condition necessary for formula (5) to evaluate equivalent to formula (3) or (4) is the limit defined in formula (6) below must converge, and more specifically I believe it must converge to zero. If this limit diverges, formula (4) will still evaluate exactly to $a(n)$ when $x=n\in\mathbb{Z}\land0<|n|\le N$, but will diverge at non-integer values of $x$.
$$\underset{N\to\infty}{\text{lim}}\left(\sum\limits_{n=1}^N\frac{b(n)}{n}\right)=0\tag{6}$$
Condition (2): The second condition necessary for formula (5) to evaluate equivalent to formula (3) or (4) is it must be possible to evaluate $\tilde{a}(0)$ defined in formula (7) below to a particular value for arbitrarily large magnitudes of the evaluation limit $N$. This implies $\tilde{a}(0)$ defined in formula (7) below can be evaluated to this specific value for an infinite number of values of $N$.
$$\tilde{a}(0)=\sum\limits_{n=1}^N b(n)\tag{7}$$
In all of the figures below, the red discrete portion of the plots represents the evaluation of the arithmetic function $a(n)$ at integer values. Formulas (3) and (4) are generally illustrated in blue (except Figure (1) which illustrates formula (4) in green) and formula (5) is always illustrated in orange.
In the case where $a(n)=1$, $f_a(x)=\lfloor x\rfloor$, $F_a(s)=\zeta(s)$, and $b(n)=\delta_{n-1}$ (Kronecker delta). For the case $a(n)=1$, Condition (2) specified above is met with respect to the potential equivalency of formulas (3) and (5), but the limit specified in Condition (1) above converges to $1$ instead of $0$.
Figure (1) below illustrates for the case $a(n)=1$, formula (5) for $\tilde{a}(x)$ (orange) is more closely related to formula (3) for $\tilde{a}(x)$ (blue) than it is to formula (4) for $\tilde{a}(x)$ (green). In the case where $a(n)=1$, formula (3) for $\tilde{a}(x)$ corresponds to the power series for $\frac{1}{2}(1+\cos(2 \pi x))$, and formula (5) for $\tilde{a}(x)$ corresponds to $\cos(2 \pi x)$.
Figure (1): Illustration of formulas (3), (4), and (5) for $\tilde{a}(x)$ (blue, green, and orange) for $a(n)=1$
In the simplest case where $a(n)=\delta_{n-1}$ (Kronecker delta function), $f_a(x)=\theta(x-1)$, $F_a(s)=1$, and $b(n)=\mu(n)$. Note conditions (1) and (2) specified above are both met since $\underset{N\to\infty}{\text{lim}}\left(\sum\limits_{n=1}^N\frac{\mu(n)}{n}\right)=0$ and $\tilde{a}(0)=\sum\limits_{n=1}^N\mu(n)$ is the Mertens function $M(N)$ which evaluates to every integer an infinite number of times.
In the case of $a(n)=\delta_{n-1}$, formulas (8) and (9) below are equivalent to formulas (3) and (4) above where $_1\tilde{F}_2()$ is the Hypergeometric PFQ Regularized function.
$$\tilde{\delta}_{x-1}=\underset{I\to\infty}{\text{lim}}\left(\sum\limits_{i=0}^I (-1)^{i+1} \pi^{2 i+\frac{5}{2}} \, _1\tilde{F}_2\left(1;i+2,i+\frac{5}{2};-\pi ^2\right) x^{2 i}\right)\tag{8}$$
$$\tilde{\delta}_{x-1}=\underset{I\to\infty}{\text{lim}}\left(\sum\limits_{i=0}^I (-1)^i \pi^{2 i+\frac{1}{2}} \, _1\tilde{F}_2\left(1;i+1,i+\frac{3}{2};-\pi ^2\right) x^{2 i}\right)\tag{9}$$
Figure (2) below illustrates formulas (3) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\delta_{n-1}$. Formula (3) is evaluated at $I=100$, and formula (5) is evaluated at $N=103$ which was selected to match the evaluation of formula (3) at $x=0$ which converges (in a limit sense) to $-2$. Note formula (5) evaluates so closely to formula (3) that the evaluation of formula (5) pretty much hides the underlying evaluation of formula (3).
Figure (2): Illustration of formulas (3) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\delta_{n-1}$
Figure (3) below illustrates formulas (4) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\delta_{n-1}$. Formula (4) is evaluated at $I=100$, and formula (5) is evaluated at $N=101$ which was selected to achieve the correct evaluation at $x=0$. Note formula (4) also converges (in a limit sense) to the correct value at $x=0$. Note formula (5) doesn't seem to evaluate as closely to formula (4) in Figure (3) below as it did to formula (3) in Figure (2) above. I've noticed formula (4) typically diverges faster (at a smaller magnitude of $x$) than formula (3) when both are evaluated at the same limit $I$ which may be part of the reason, but it may also be that formula (5) is not as closely related to formula (4) as it is to formula (3) which was clearly the case illustrated in Figure (1) above for $a(n)=1$.
Figure (3): Illustration of formulas (4) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\delta_{n-1}$
Question (1): Assuming $a(n)=\delta_{n-1}$, can it be shown that formula (5) above is exactly equivalent to formula (3) and/or formula (4) above as $I\to\infty$ and $N\to\infty$ with the additional constraint $N$ is selected such that formula (7) for $\tilde{a}(0)$ matches the evaluation of formula (3) and/or formula (4) for $\tilde{a}(x)$ at $x=0$?
In the case where $a(n)=\mu(n)$ (Moebius function), $f_a(x)=M(x)$ which is the Mertens function, $F_a(s)=\frac{1}{\zeta(s)}$, and $b(n)=\sum\limits_{d|n}\mu(d)\,\mu\left(\frac{n}{d}\right)$. Note condition (1) specified above is met since $\underset{N\to\infty}{\text{lim}}\left(\sum\limits_{n=1}^N \frac{b(n)}{n}\right)=0$ (see this answer to my related question on Math StackExchange). The second necessary condition for equivalence of formula (5) to formulas (3) or (4) in the case of $a(n)=\mu(n)$ is it must be possible to evaluate formula (7) above for $\tilde{a}(0)$ to $4$ or $0$ for arbitrarily large magnitudes of the limit $N$. I believe this condition is met but this is still an open issue (see my related question on Math StackExchange).
Figure (4) below illustrates formulas (3) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\mu(n)$. Formula (3) is evaluated at $I=100$, and formula (5) is evaluated at $N=141$ which was selected to match the evaluation of formula (3) at $x=0$ which converges (in a limit sense) to $4$. Note formula (5) evaluates so closely to formula (3) that the evaluation of formula (5) pretty much hides the underlying evaluation of formula (3).
Figure (4): Illustration of formulas (3) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\mu(n)$
Figure (5) below illustrates formulas (4) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\mu(n)$. Formula (4) is evaluated at $I=100$, and formula (5) is evaluated at $N=140$ which was selected to achieve the correct evaluation at $x=0$. Note formula (4) also converges (in a limit sense) to the correct value at $x=0$. Note formula (5) doesn't seem to evaluate as closely to formula (4) in Figure (5) below as it did to formula (3) in Figure (4) above.
Figure (5): Illustration of formulas (4) and (5) for $\tilde{a}(x)$ (blue and orange) where $a(n)=\mu(n)$
Question (2): Assuming $a(n)=\mu(n)$, can it be shown that formula (5) above is exactly equivalent to formula (3) and/or formula (4) above as $I\to\infty$ and $N\to\infty$ with the additional constraint $N$ is selected such that formula (7) for $\tilde{a}(0)$ matches the evaluation of formula (3) and/or formula (4) for $\tilde{a}(x)$ at $x=0$?
In the case where $a(n)=(-1)^{n-1}$, $f_a(x)=\frac{1}{2}\left(1-\text{SquareWave}\left(\frac{x}{2}\right)\right)$, $F_a(s)=\eta(s)$ (Dirichlet eta function), and $b(n)=\{1,-2,0,0,0,...\}$ ($b(1)=1$, $b(2)=-2$, and $b(n)=0$ for $n>2$). For the case $a(n)=(-1)^{n-1}$, Conditions (1) and (2) specified above are both met with respect to the equivalency of formulas (3) and (5) for $\tilde{a}(x)$.
Figure (6) below illustrates for the case $a(n)=(-1)^{n-1}$, formula (5) for $\tilde{a}(x)$ (orange) is exactly equivalent to formula (3) for $\tilde{a}(x)$ (blue) but much less closely related to formula (4) for $\tilde{a}(x)$ (green). In the case where $a(n)=(-1)^{n-1}$, formula (3) for $\tilde{a}(x)$ corresponds to the power series for $-cos(\pi x)$, and formula (5) for $\tilde{a}(x)$ also corresponds to $-\cos(\pi x)$.
Figure (6): Illustration of formulas (3), (4), and (5) for $\tilde{a}(x)$ (blue, green, and orange) for $a(n)=(-1)^{n-1}$
The discrete plot in Figure (7) below illustrates the relationship between the evaluation of the offset defined in formula (6) (orange) and the evaluation of formula (5) for $\tilde{a}(1.5)$ (blue) for the case $a(n)=\delta_{n-1}$ where $b(n)=\mu(n)$ and formula (7) for $\tilde{a}(0)$ corresponds to the Mertens function $M(N)$. Both formulas are evaluated at the zeros of the Mertens function in the range $1\le N\le 10000$ corresponding to Condition (2) necessary for the equivalence of formulas (4) and (5) for $a(n)=\delta_{n-1}$. There are $406$ zeros of the Merten's function in the range $1\le N\le 10000$ with the first occurring at $N=2$ and the last occuring at $N=9256$. The horizontal axis in Figure (6) below represents of the index of the Merten's function zero. Note the oscillations in the evaluation of $\tilde{a}(1.5)$ (blue) are opposite in sign but nearly equal in magnitude to the oscillations in the evaluation of the formula (6) offset (orange). Since the offset in formula (6) converges to zero as $N\to\infty$, it would seem the oscillations in the evaluation of formula (5) for $\tilde{a}(1.5)$ also converge to zero as $N\to\infty$ when $\tilde{a}(0)=M(N)=0$.
Figure (7): Illustration of formula (5) for $\tilde{a}(1.5)$ and the offset in formula (6) as a function 0f $N$ where $a(n)=\delta_{n-1}$ and the horizontal axis represents the index of $\tilde{a}(0)=M(N)=0$
The value $x=1.5$ was selected for Figure (7) above for a couple of reasons. First, formula (5) for $\tilde{a}(x)$ evaluates exactly correct when $x=n\in\mathbb{Z}\land0<|n|\le N$, so it seemed to me $\tilde{a}(x)$ would vary more halfway between integer values than it does when evaluated closer to integer values. Second, formula (5) for $\tilde{a}(1.5)$ and the offset corresponding to formula (6) both evaluate close to zero as $N$ increases which allows the plot range to be magnified when both functions are combined on the same plot thereby providing visibility into the finer details. The magnified plot range illustrated in Figure (7) above truncated some of the earlier evaluation points corresponding to smaller values of $N$ where formula (5) for $\tilde{a}(x)$ and the offset defined in formula (6) evaluated to larger magnitudes before they started to exhibit better convergence.