MathOverflow will be down for maintenance for approximately 3 hours, starting Monday evening (06/24/2013) at approximately 9:00 PM Eastern time (UTC-4).

2 clarifying comment

It's always a good idea to plug the first few terms into the OEIS. For 1,1,5,10,30,26, this leads to http://oeis.org/A053818 from which there's a reference to an exercise in Apostol's Introduction to Analytic Number Theory deriving the formula

$${1\over3}n^2\varphi(n) + {n\over6}\prod_{p|n}(1-p)$$

Added 11/12/12: I neglected to mention, the exercise in Apostol specifies the formula only applies for $n>1$. (Also, I had inadvertently switched, without saying so, from the OP's $k$ to Apostol's $n$.)

1

It's always a good idea to plug the first few terms into the OEIS. For 1,1,5,10,30,26, this leads to http://oeis.org/A053818 from which there's a reference to an exercise in Apostol's Introduction to Analytic Number Theory deriving the formula

$${1\over3}n^2\varphi(n) + {n\over6}\prod_{p|n}(1-p)$$