\[\sum_{\begin{subarray}{c}k=1\\
\left(k,m\right)=1\end{subarray}}^{m}k^{n}=\frac{1}{n+1}\sum_{j=1}^{n+1}{n+1%
\choose j}\*\left(\prod_{p\mathbin{|}m}(1-p^{n-j})B_{n+1-j}\right)m^{j}.\]