TITLE: Identity involving Euler's totient function: $\sum \limits_{k=1}^n \left\lfloor \frac{n}{k} \right\rfloor \varphi(k) = \frac{n(n+1)}{2}$
QUESTION [48 upvotes]: Let $\varphi(n)$ be Euler's totient function, the number of positive integers less than or equal to $n$ and relatively prime to $n$.  
Challenge: Prove
$$\sum_{k=1}^n \left\lfloor \frac{n}{k} \right\rfloor \varphi(k) = \frac{n(n+1)}{2}.$$
I have two proofs, one of which is partially combinatorial.  
I'm posing this problem partly because I think some folks on this site would be interested in working on it and partly because I would like to see a purely combinatorial proof.  (But please post any proofs; I would be interested in noncombinatorial ones, too.  I've learned a lot on this site by reading alternative proofs of results I already know.)
I'll wait a few days to give others a chance to respond before posting my proofs.
EDIT: The two proofs in full are now given among the answers.

REPLY [18 votes]: In case anyone is interested, here are the full versions of my two proofs.  (I constructed the combinatorial one from my original partially combinatorial one after I posted the question.)

The non-combinatorial proof 
As Derek Jennings observes, $\lfloor \frac{n+1}{k} \rfloor - \lfloor \frac{n}{k} \rfloor$ is $1$ if $k|(n+1)$ and $0$ otherwise.  Thus, if $$f(n) = \sum_{k=1}^n \left\lfloor\frac{n}{k} \right\rfloor \varphi (k),$$
then $$\Delta f(n) = f(n+1) - f(n) = \sum_{k|(n+1)} \phi(k) = n+1,$$
where the last equality follows from the well-known formula Aryabhata cites.
Then
$$\sum_{k=1}^n \left\lfloor\frac{n}{k} \right\rfloor \varphi (k) = f(n) = \sum_{k=0}^{n-1} \Delta f(k) = \sum_{k=0}^{n-1} (k+1) = \frac{n(n+1)}{2}.$$

The combinatorial proof
Both sides count the number of fractions (reducible or irreducible) in the interval (0,1] with denominator $n$ or smaller.  
For the right side, the number of ways to pick a numerator and a denominator is the number of ways to choose two numbers with replacement from the set $\{1, 2, \ldots, n\}$.  This is known to be 
$$\binom{n+2-1}{2} = \frac{n(n+1)}{2}.$$
Now for the left side.  The number of irreducible fractions in $(0,1]$ with denominator $k$ is equal to the number of positive integers less than or equal to $k$ and relatively prime to $k$; i.e., $\varphi(k)$.  Then, for a given irreducible fraction $\frac{a}{k}$, there are $\left\lfloor \frac{n}{k} \right\rfloor$ total fractions with denominators $n$ or smaller in its equivalence class.  (For example, if $n = 20$ and $\frac{a}{k} = \frac{1}{6}$, then the fractions $\frac{1}{6}, \frac{2}{12}$, and $\frac{3}{18}$ are those in its equivalence class.)  Thus the sum 
$$\sum_{k=1}^n \left\lfloor\frac{n}{k} \right\rfloor \varphi (k)$$
also gives the desired quantity.