Lecture 11: Phi function, Euler's formula, Probabilistic Primality Testing
Euler Phi Function
First, let’s define the Euler
φ
(phi) function:
φ
(n) = the number of integers in the set {1, 2, .
.., n1} that are relatively prime to n.
φ
(p) = p –1 , for all prime numbers
φ
(pq) = (p1)(q1), where p and q are distinct primes. Here is a derivation of that result:
We want to count all values in the set {1, 2, 3, .
.., pq –1} that are relatively prime to pq.
Instead, we could count all value in the set NOT relatively prime to pq. We can list these
values:
p, 2p, 3p, .
.. , (q1)p
q, 2q, 3q, .
.. (p1)q
Note that each of these values are distinct. To notice this, see that no number of the first
row is divisible by q and no number on the second row is divisible by p. This ensures that
there are no repeats on both rows. since p and q are relatively prime, in order for q to be a
factor of a number on the first row, it would have to divide evenly into either 1, 2, 3, .
.. q
1. But clearly, it does not. The same argument will show that none of the values on the
second row are divisible by p.
Finally, we can count the number of values on this list. It’s (q1) + (p1) = p + q – 2.
Now, in order to find
φ
(pq), we must subtract this value from pq –1 . So, we find:
φ
(pq) = (pq – 1) – (p + q – 2) = pq – p – q +1 = (p – 1)(q – 1).
Here is a different proof of the general formula for deriving
φ
(n) given n’s prime
factorization than the one shown in class. It is based upon the same ideas as the one given
in class, but does so by proving the actual formula, instead of proving that
φ
(mn) =
φ
(m)
φ
(n), if m and n are relatively prime. As you'll see, all the key steps in that proof are
included below in the inductive step.
Now, we will look and prove the general formula for
φ
(n) given n’s prime factorization.
Let n =
∏
=
r
i
e
i
i
p
1
, where each
p
i
is a distinct prime number.
Then, we have that
φ
(n) =
∏
=


r
i
e
i
e
i
i
i
p
p
1
1