# On simple closed-forms involving the Euler's totient function and the Digamma function

In the Wikipedia article for the Digamma function one finds some identities due to Gauss. I've used the fourth of those from the section Some finite sums involving the digamma function to show if there were no mistakes that for $m>1$

$$\sum_{\substack{1\leq k\leq m-1 \\ (k,m)=1}}\sum_{r=1}^{m-1}\psi\left(\frac{r}{m}\right)\sin\left(\frac{2\pi r k}{m}\right)=\pi\frac{m\phi(m)}{2}-\pi\frac{m\phi(m)}{2}=0,$$

where $\phi(m)$ is the Euler's totient function and as you see in the reference $\psi(s)$ is the digamma function.

My approach was use Apostol's Exercise 14 with $f(x)=x$, from Chapter 2 of Apostol, Introduction to Analytic Number Theory, Springer (1976), also I need that $\sum_{\substack{1\leq k\leq m-1 \\ (k,n)=1}}k=\frac{n}{2}\phi(n)+\frac{n}{2}\sum_{d\mid n}\mu(d)=\frac{n}{2}\phi(n)+\frac{n}{2}$, on assumption that $n>1$. Also the Gauss identity for the sum of the first $n$ positive integers.

Question 1. Can you say if my statement (the first identity of current post) was right? Thanks.

After I tried the same with the other identity that is feasible do this calculations, that is the third, also due to Gauss. My calculations were $$\sum_{\substack{1\leq k\leq m-1 \\ (k,m)=1}}\sum_{r=1}^{m-1}\psi\left(\frac{r}{m}\right)\cos\left(\frac{2\pi r k}{m}\right)=m\phi(m)\log 2+m\cdot\log\left(\prod_{\substack{1\leq k\leq m-1 \\ (k,m)=1}}\sin \frac{k\pi}{m}\right)+\gamma\phi(m).$$

There was a typo, fixed.

Question. Is there a nice closed-form for the factor $$\prod_{\substack{1\leq k\leq m-1 \\ (k,m)=1}}\sin \frac{k\pi}{m}$$ in the context of this post (I say nice/good in the context of the first question)? Thanks in advance.

About the first question the answer is yes. Note that $$\sum_{\underset{{\scriptstyle \left(k,m\right)=1}}{1\leq k\leq m}}k=\sum_{\underset{{\scriptstyle \left(k,m\right)=1}}{1\leq k\leq m-1}}k=\frac{m\phi\left(m\right)}{2}\tag{1}$$ so $$\sum_{\underset{{\scriptstyle \left(k,m\right)=1}}{1\leq k\leq m-1}}\sum_{r\leq m-1}\psi\left(\frac{r}{m}\right)\cos\left(\frac{2\pi rk}{m}\right)=\pi\sum_{\underset{{\scriptstyle \left(k,m\right)=1}}{1\leq k\leq m-1}}k-\frac{\pi m}{2}\sum_{\underset{{\scriptstyle \left(k,m\right)=1}}{1\leq k\leq m-1}}1=\color{red}{0}.$$ About the second question we have that (we will indicate the condition $\left(k,m\right)=1$ with the symbol $'$)$$\prod_{k=1}^{m-1}'\sin\left(\frac{\pi k}{m}\right)=\prod_{k=1}^{m-1}'\frac{e^{i\pi k/m}-e^{-i\pi k/m}}{2i}$$ $$=\left(2i\right)^{-\phi\left(m\right)}\prod_{k=1}^{m-1}'e^{-i\pi k/m}\prod_{k=1}^{m-1}'\left(e^{2i\pi k/m}-1\right)$$ $$=\left(2i\right)^{-\phi\left(m\right)}e^{-i\pi\phi\left(m\right)/2}\prod_{k=1}^{m-1}'\left(e^{2i\pi k/m}-1\right)$$ $$=\left(-2i\right)^{-\phi\left(m\right)}e^{-i\pi\phi\left(m\right)/2}\prod_{k=1}^{m-1}'\left(1-\zeta_{m}^{k}\right)$$ where in the second last identity we used again $(1)$ and in the last identity we wrote $$e^{2i\pi k/m}=\zeta_{m}^{k}$$ i.e. the usual way to indicate the $n-$th roots of unity and we changed sign. So we have done, since the last product has already been studied by Steven Galovich (see here) and $$\prod_{k=1}^{m-1}'\left(1-\zeta_{m}^{k}\right)=e^{\Lambda\left(m\right)}=\begin{cases} p, & m=p^{n}\textrm{ for some }n\geq1\\ 1, & \textrm{otherwise} \end{cases}$$ where $\Lambda\left(m\right)$ is the Von Mangoldt function. It remains to note that $$\left(-2i\right)^{-\phi\left(m\right)}=2^{-\phi\left(m\right)}\left(-1\right)^{3\phi\left(m\right)/2}$$ and $$\exp\left(\frac{-i\pi\phi\left(m\right)}{2}\right)=\cos\left(\frac{\pi\phi\left(m\right)}{2}\right)$$ since $\phi\left(n\right)$ is even. So finally
$$\prod_{k=1}^{m-1}'\sin\left(\frac{\pi k}{m}\right)=\color{red}{2^{-\phi\left(m\right)}e^{\Lambda\left(m\right)}}$$
since $$\left(-1\right)^{3\phi\left(m\right)/2}\cos\left(\frac{\pi\phi\left(m\right)}{2}\right)=1.$$ Note that you can also write $$e^{\Lambda\left(m\right)}=\frac{\textrm{lcm}\left(1,\dots,m\right)}{\mbox{lcm}\left(1,\dots,m-1\right)}.$$