As an example, suppose the modulus is m=12. The numbers which are
not relatively prime to 12 are those that are divisible by 2 or 3,
since they make up the factors of 12. If we just consider the
numbers from 0 to 11 (since these represent all numbers modulo 12),
the ones which avoid 2's and 3's are
Each modulus m has only so many congruence classes of numbers; they
correspond to the numbers from 0 to m-1. There is therefore a
definite number of these which are relatively prime to m. That
number is usually written as
and is called Euler's
totient function or phi function. (The word totient
has something vaguely to do with counting, which is how it came up,
but let's face it: it's just another one of those weird math terms.)
We have just seen that
.
Computing the Euler function for a prime modulus p is especially
simple. Every number from 1 to p-1 is relatively prime to p;
that's what being a prime means. So we conclude
.
A prime power m=pn is just a little more complicated. A number ais relatively prime to pn provide p is not a divisor of a,
because p is the only prime divisor of pn. So the numbers that
have to be ruled out are 0, p, 2p, 3p, ... ,
(pn-1 -1)p.
There are exactly pn-1 of those. That means the number of
relatively prime classes is
.
That leads to a general modulus m. In that case, what we do is first
factor m into prime powers, and amazingly
is the product
of the
function for each one of those prime powers. For
example, 12 =
.
Then
.
This makes it quite easy to compute
for
larger numbers, provided we know the factorization of m. For
example, for
,
we have
.