Closed form for $f(n)=\sum_{d\mid n}(-1)^{d}.d$?

57 Views Asked by At

Can we find a closed form for $f(n)=\sum_{d\mid n}(-1)^{d}.d$. If $n$ is odd obviously $f(n)=-\sigma(n) $ when $\sigma(n)$ is the sum of divisors function. So when $n$ is even, how to find $f(n)$?

1

There are 1 best solutions below

0
On BEST ANSWER

If $n=2^k m$ with $m$ odd, our sum equals: $$ -\sum_{d\mid m}d + \sum_{\substack{d\mid n\\ d\text{ even}}}d =-\sigma(m)+\left(\sigma(n)-\sum_{\substack{d\mid n\\ d\text{ odd}}}d\right)=\color{red}{\sigma(n)-2\cdot\sigma(m)}.$$ Since $\sigma(n)=\sigma(m)\sigma(2^k) = (2^{k+1}-1)\cdot\sigma(m)$, that can be written as $\color{red}{ (2^{k+1}-3)\cdot\sigma(m)}$, too.