In a course on cryptography we should prove that if $n$ is of the form $p_1^{k_1} \cdot \ldots \cdot p_l^{k_l}$ and $p_1, \ldots, p_l$ are all distinct prime numbers then $$ \varphi \left(\prod\limits_{i=1}^{l} p_i^{k_i}\right) = \prod\limits_{i=1}^lp_i^{k_i-1} \cdot (p_i - 1) = n \cdot \prod\limits_{i=1}^l \frac{p_i - 1}{p_i}$$ holds.
We got the hint that if $n$ is a prime number, then $\varphi(n) = n - 1$, but still I'm stuck on this. First of all, I'm not even sure how to interpret $\prod\limits_{i=1}^lp_i^{k_i-1}$: As an example, take 330, which is composed of $\{2, 3, 5, 11\}$. Then $p_1 = 2, p_2 = 3, \ldots$, but what is $p_1^{k_1}$ and $p_1^{k_1-1}$ in this context?
Next, I'm not sure how to prove this. Can someone give me a push in the right direction?
It's straightforward to see that for a prime number $p$ and a natural number $n$, we have $\varphi(p^n)=p^n{p-1\over p}$. You said you already know the following property: if $\gcd(a,b)=1$, then $\varphi(ab)=\varphi(a)\varphi(b)$. It can be extended for any finite product of coprime natural numbers. So, suppose $n$ is a natural number. By the unique factorization theorem, there exist prime numbers $p_1,\dots,p_l$ and natural numbers $k_1,\dots,k_l$ such that $$n = p_1^{k_1}p_2^{k_2}\dots p_l^{k_l}.$$ The factors $p_1^{k_1},\dots,p_l^{k_l}$ are all relatively prime. So $$\varphi(n) = \varphi(p_1^{k_1}p_2^{k_2}\dots p_l^{k_l})= \varphi(p_1^{k_1})\varphi(p_2^{k_2})\dots\varphi(p_l^{k_l}) = p_1^{k_1}{p_1-1\over p_1}p_2^{k_2}{p_2 -1\over p_2}\dots p_l^{k_l}{p_l-1\over p_l}.$$
The last term is easily seen to be equal to $\displaystyle n \prod_{i=1}^l {p_i-1\over p_i}$, the result we were seeking.