Euler's Phi function

Euler's Phi function, also known as the totient function, is a function that, for a given $$N$$, calculates the number of positive integers smaller than $$N$$ that are relatively prime to $$N$$.

Definition
$$\phi(N) = \Sigma_{1 ... N-1} ( 1 if gcd( i, N ) = 1 )$$

Properties

 * $$\phi(N) = N - 1$$ if $$N$$ is prime.
 * $$\phi(N)$$ is even for all $$N > 2$$.
 * Let $$n = p_1 * p_2 * ... * p_x$$, where $$p_i$$ is a prime. Then $$\phi(N) = N ( 1 - \frac{1}{p_1} )( 1 - \frac{1}{p_2} ) ... ( 1 - \frac{1}{p_x} )$$