Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The problem is contained in the headline: Is it possible to simplify the sum $\displaystyle \sum\limits_{k=1}^n 2^{\text{gcd}(k,n)}$?

share|cite|improve this question
$$\sum_{k=1}^n 2^{\gcd(k,n)} = \sum_{d \vert n}\phi(n/d) 2^d$$ I do not know if this can be simplified further. – user17762 Jan 18 '13 at 0:31
The equation in Marvis's comment is a special instance of a polynomial identity: $\sum_{k=1}^n x^{\gcd(k,n)} = \sum_{d|n} \varphi(n/d)x^d$. At $x = 1$ it is the equation $n = \sum_{d|n} \varphi(d)$. At $x = 2$ it is the equation Marvis wrote down. – KCd Jan 18 '13 at 4:17

As Marvis said, $$\sum_{k=1}^n2^{\text{gcd}(k,n)}=\sum_{d\mid n}\varphi(n/d)2^d.$$ Here's a cool article I found on OEIS detailing one way the expression occurs in combinatorics.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.