How to show that $$\gcd(a,b)=\sum_{k\mid a\text{ and }k\mid b}\varphi(k).$$
$\varphi$ is the Euler's totient function.
I was trying to prove the number of homomorphisms from a cyclic group of order $m$ and $n$ is $\gcd(n,m)$.
Every cyclic group of order $n$ is isomorphic to $Z_n$. Hence a homomorphism from $Z_n$ to $Z_m$ is completely determined by the image of $1 \in Z_n$. If $1$ maps to $a$, I know that $|a|$ should divide both $n$ and $m$. So $|a|$ are common divisors of $n$ and $m$. Let $d$ be any positive common divisor of $n$ and $m$, then the number of elements of order $d$ in a cyclic group of order $n$ is $\phi(d)$. Then the number of candidates for $a$ is $\sum_{d|n\,and\,d|m}\varphi(d)$. If I am able to show the above relation, I'm done.