Can $\sum_{k=1}^n \arctan(\cot(\frac{\pi n}{k}))$ be simplified

divisor-counting-functionsummationtrigonometry

I found this relation about the floor function on some forum:
$$⌊x⌋ = x -\frac{1}{2}+\frac{\arctan(\cot(\pi x))}{\pi}$$

I found it intriguing as this could be used in relating several non – continuous expressions with trigonometric ones. Hence, I tried to use it for an expression of the divisor function (i. e. $d(n)$) which just gives how many divisors the argument has.

Now I find myself stuck, as apparently to progress further I need to find the partial sum of the following:
$$\sum_{k=1}^n \arctan(\cot(\frac{\pi n}{k}))$$
I felt like I couldn't do it by myself so asked you guys. I'm not sure whether there is a neat solution for my problem or not but would be glad if you gave any insights or feedback.

Best Answer

Let $\left\{ x\right\} = x-\lfloor x \rfloor$ denote the fractional part of $x$. From what you've written above, we have $$ \frac{1}{\pi}\arctan(\cot(\pi x)) = \frac{1}{2}-\left\{x\right\}. $$ The classical Dirichlet's divisor problem is to quantify the error term $\Delta(x)$ in $$ \sum_{k=1}^n d(k) = n\log n + (2\gamma-1) n + \Delta(n). $$ The sum on the left counts the number of lattice points on or below the hyperbola $ab = n$ (this is the foundation of Dirichlet's hyperbola method). Consequently, the sum on the left can be rewritten as $$ \sum_{k=1}^n d(k) = \sum_{k=1}^n \left\lfloor \frac{n}{k} \right\rfloor = \sum_{k=1}^n \frac{n}{k} - \sum_{k=1}^n \left\{ \frac{n}{k}\right\}. $$ With regards to your specific question, we then have $$ \sum_{k=1}^{n} \arctan\left(\cot\left(\frac{\pi n}{k}\right)\right) = \pi \sum_{k=1}^{n} \left(\frac{1}{2}-\left\{\frac{n}{k}\right\} \right) = \frac{\pi n}{2} + \pi \sum_{k=1}^n d(k) - \pi \sum_{k=1}^n \frac{n}{k}. $$ The sum involving $d(k)$ can be evaluated using the latest results on Dirichlet's divisor problem, and the other sum on the right can be evaluated to arbitrary precision using partial summation.

Related Question