Euler's totient function
In number theory, the totient of a positive integer is the number of integers smaller than n which are coprime to n (they share no factors except 1).
For example, [math]\displaystyle{ \phi(8) = 4 }[/math], because the four numbers: 1, 3, 5 and 7 don't share any factors with 8. The function [math]\displaystyle{ \phi }[/math] used here is the totient function, usually called the Euler totient or Euler's totient, after the Swiss mathematician Leonhard Euler, who studied it. The totient function is also called Euler's phi function or simply the phi function, since the Greek letter Phi ([math]\displaystyle{ \phi }[/math]) is so commonly used for it. The cototient of n is defined as [math]\displaystyle{ n - \phi(n) }[/math].
The totient function is important mainly because it gives the size of the multiplicative group of integers modulo n. More precisely, [math]\displaystyle{ \phi(n) }[/math] is the order of the group of units of the ring [math]\displaystyle{ \mathbb{Z}/n\mathbb{Z} }[/math]. This fact, together with Lagrange's theorem, provides a proof for Euler's theorem.
A common use of the totient function is in the RSA algorithm. The RSA algorithm is a popular method of encryption used worldwide.
For any prime number, p, [math]\displaystyle{ \phi(p) = p-1 }[/math].