# $\sum_{k=0}^\infty\frac{ (-1)^{\left\lfloor\frac kn\right\rfloor}}{k+1}$

While testing a program I came across an interesting equality: $$\sum_{k=0}^\infty\frac{ (-1)^{\left\lfloor\frac kn\right\rfloor}}{k+1} =\frac1n\left[\log2+\frac\pi2\sum_{k=1}^{n-1}\tan\frac{k\pi}{2n}\right],$$ which generalises the well-known identity for $$n=1$$. Is there a simple way to prove it?

• A quick note that the $n=1$ and $n=2$ cases are trivial to prove by division of the LHS into the well-known series $\log 2 = 1 - \frac{1}{2} + \frac{1}{3} - \cdots$ and $\frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \cdots$. – Connor Harris Mar 18 '19 at 19:17
• I've noticed by numeric testing, and am trying to prove, a result that may help: for $1 \leq k \leq n-1$, $$\sum_{i=0}^\infty \frac{(-1)^i}{in + k} + \frac{(-1)^i}{in + n - k} = \frac{\pi}{n} \csc \frac{k \pi}{n}.$$ The LHS of this equation contains $2/n$ of the terms in the LHS of your identity. – Connor Harris Mar 18 '19 at 20:19
• @ConnorHarris It is very interesting observation. I think I see now the pattern. – user Mar 18 '19 at 21:04
• This may also be relevant: math.stackexchange.com/questions/581162/… – Connor Harris Mar 18 '19 at 21:10
• Yeah, I think this turns out to be an immediate corollary of the Herglotz trick $$\pi \cot (\pi x) = \lim_{N \to \infty} \sum_{n=-N}^N \frac{1}{n+x}.$$ The application to this series is to combine the positive terms with denominator $\equiv k \bmod 2n$ and the negative terms with denominator $\equiv 2n-k \bmod 2n$ into one series (with a bit of argumentation to show that the rearrangement of terms is licit), then change variables to fit the form of the Herglotz trick. The terms with denominators that are a multiple of $n$ then give the remaining $\frac{1}{n} \log 2$. – Connor Harris Mar 18 '19 at 23:55

For $$n \in \mathbb{N}$$ write $$k = m n + l - 1$$ with $$m \in \mathbb{N}_0$$ and $$l \in \{1,\dots,n\}$$. Then $$\left\lfloor \frac{k}{n} \right\rfloor = m$$, so \begin{align} S_n &\equiv \sum \limits_{k=0}^\infty \frac{(-1)^{\left\lfloor \frac{k}{n} \right\rfloor}}{k+1} \stackrel{1.}{=} \sum \limits_{l=1}^n \sum \limits_{m=0}^\infty \frac{(-1)^m}{m n +l} = \frac{1}{n} \left[\sum \limits_{m=0}^\infty \frac{(-1)^m}{m+1} + \sum \limits_{l=1}^{n-1} \sum \limits_{m=0}^\infty \frac{(-1)^m}{m + \frac{l}{n}}\right] \\ &\equiv \frac{1}{n} \left[\log (2) + \sum \limits_{l=1}^{n-1} a_l \right] , \end{align} where $$a_l = \sum \limits_{m=0}^\infty \frac{(-1)^m}{m + \frac{l}{n}} \stackrel{2.}{=} \sum \limits_{j=0}^\infty \left[\frac{1}{2j + \frac{l}{n}} - \frac{1}{2j+1 + \frac{l}{n}}\right] , \, l \in \{1,\dots,n-1\}.$$ For $$l \in \{1,\dots,n-1\}$$ consider \begin{align} a_l + a_{n-l} &= \sum \limits_{j=0}^\infty \left[\frac{1}{2j + \frac{l}{n}} - \frac{1}{2j+1 + \frac{l}{n}} + \frac{1}{2j+1-\frac{l}{n}} - \frac{1}{2j+2 - \frac{l}{n}}\right] \\ &\stackrel{3.}{=} \frac{\pi}{2} \left[8 \frac{l \pi}{2n} \sum \limits_{j=0}^\infty \frac{1}{(2j+1)^2 \pi^2 - 4 \left(\frac{l \pi}{2n}\right)^2} + \frac{2n}{l\pi} + 2 \frac{l\pi}{2n} \sum \limits_{j=1}^\infty \frac{1}{\left(\frac{l \pi}{2n}\right)^2 - j^2 \pi^2}\right] \\ &= \frac{\pi}{2} \left[\tan \left(\frac{l\pi}{2n}\right) + \cot \left(\frac{l\pi}{2n}\right)\right] = \frac{\pi}{2} \left[\tan \left(\frac{l\pi}{2n}\right) + \tan \left(\frac{(n-l)\pi}{2n}\right)\right] . \end{align} The pole expansions of $$\tan$$ and $$\cot$$ are discussed here and here, respectively. This also works for $$l = \frac{n}{2}$$ if $$n$$ is even, so we obtain $$S_n = \frac{1}{n}\left[\log(2) + \frac{\pi}{2} \sum \limits_{l=1}^{n-1} \tan \left(\frac{l \pi}{2n}\right)\right]$$ as conjectured.
1. For $$L \in \{1,\dots,n\}$$ and $$M \in \mathbb{N}_0$$ we have $$\sum \limits_{k=0}^{M n + L - 1} \frac{(-1)^{\left\lfloor \frac{k}{n} \right\rfloor}}{k+1} = \sum \limits_{l=1}^L \sum \limits_{m=0}^M \frac{(-1)^m}{m n +l} + \sum \limits_{l=L+1}^n \sum \limits_{m=0}^{M-1} \frac{(-1)^m}{m n +l} \stackrel{M \to \infty}{\longrightarrow} \sum \limits_{l=1}^n \sum \limits_{m=0}^\infty \frac{(-1)^m}{m n +l} \, .$$ Therefore, the sequence $$\left(\sum_{k=0}^{K} \frac{(-1)^{\left\lfloor k/n \right\rfloor}}{k+1}\right)_{K \in \mathbb{N}_0}$$ is bounded and has exactly one limit point (namely $$\sum_{l=1}^n \sum_{m=0}^\infty \frac{(-1)^m}{m n +l}$$), to which it must converge.
2. For $$M \in \mathbb{N}_0$$ we have \begin{align} \sum \limits_{m=0}^M \frac{(-1)^m}{m + \frac{l}{n}} &= \sum \limits_{j=0}^{\left\lfloor \frac{M}{2}\right\rfloor} \frac{1}{2j + \frac{l}{n}} - \sum \limits_{j=0}^{\left\lfloor \frac{M-1}{2}\right\rfloor} \frac{1}{2j + 1 + \frac{l}{n}} \\ &= \sum \limits_{j=0}^{\left\lfloor \frac{M}{2}\right\rfloor} \left[\frac{1}{2j + \frac{l}{n}} - \frac{1}{2j+1 + \frac{l}{n}}\right] + \frac{\mathbf{1}_{2\mathbb{N}} (M)}{M+1 + \frac{l}{n}} \end{align} and letting $$M \to \infty$$ proves the asserted equality.
3. For $$J \in \mathbb{N}_0$$ we can write $$\sum \limits_{j=0}^J \left[\frac{1}{2j + \frac{l}{n}} - \frac{1}{2j+2 - \frac{l}{n}}\right] = \frac{n}{l} - \frac{1}{2J + 2 - \frac{l}{n}} + \sum \limits_{j=1}^{J} \left[\frac{1}{2j + \frac{l}{n}} - \frac{1}{2j - \frac{l}{n}}\right] .$$ Both sides converge as $$J \to \infty$$ and the limits must be equal.