AoPSWiki
Looking for a challenging geometry text? Preparing for MATHCOUNTS or the AMC exams? Check out Art of Problem Solving's Introduction to Geometry by Richard Rusczyk.
Personal tools

Euler's totient function

From AoPSWiki

Euler's totient function applied to a positive integer is defined to be the number of positive integers less than or equal to that are relatively prime to . is read "phi of n."

Contents

Formulas

To derive the formula, let us first define the prime factorization of as n =\prod_{i=1}^{m}p_i^{e_i} =p_1^{e_1}p_2^{e_2}\cdots p_m^{e_m} where the are distinct prime numbers. Now, we can use a PIE argument to count the number of numbers less than or equal to that are relatively prime to it.

First, let's count the complement of what we want (i.e. all the numbers less than that share a common factor with it). There are p_1^{e_1-1}p_2^{e_2}\cdots p_m^{e_m} numbers less than that are divisible by . If we do the same for each and add these up, we get

p_1^{e_1-1}p_2^{e_2}\cdots p_m^{e_m} + p_1^{e_1}p_2^{e_2-1}\cdots p_m^{e_m} + \cdots + p_1^{e_1}p_2^{e_2}\cdots p_m^{e_m - 1}.

We can factor out, though:

p_1^{e_1-1}p_2^{e_2-1}\cdots p_m^{e_m-1}(p_1+p_2+\cdots + p_m).

But we are obviously overcounting. We then subtract out those divisible by two of the . We continue with this PIE argument to figure out that the number of elements in the complement of what we want is

p_1^{e_1-1}p_2^{e_2-1}\cdots p_m^{e_m-1}[(p_1+p_2+\cdots+p_m)-(p_1p_2+p_1p_3+\cdots+p_{m-1}p_m)+\cdots+(-1)^{m+1}(p_1p_2\cdots p_m)]

which we can factor further as

p_1^{e_1-1}p_2^{e_2-1}\cdots p_m^{e_m-1}(p_1-1)(p_2-1)\cdots(p_m-1).

Making one small adjustment, we write this as

\phi(n) = n\left(1-\frac 1{p_1}\right)\left(1-\frac 1{p_2}\right)\cdots\left(1-\frac 1{p_m}\right).

Given the general prime factorization of {n} = {p}_1^{e_1}{p}_2^{e_2} \cdots {p}_m^{e_m}, one can compute using the formula \phi(n) = n\left(1-\frac{1}{p_1}\right)\left(1-\frac{1}{p_2}\right) \cdots \left(1-\frac{1}{p_m}\right)

Identities

For prime p, , because all numbers less than are relatively prime to it.

For relatively prime , \phi{(a)}\phi{(b)} = \phi{(ab)}.

In fact, we also have for any that \phi{(a)}\phi{(b)}\gcd(a,b)=\phi{(ab)}\phi({\gcd(a,b)}).

For any , we have where the sum is taken over all divisors d of .

Proof. Split the set into disjoint sets where for all we have A_d=\{x:1\leq x\leq n\quad\text{and}\quad \operatorname{syt}(x,n)=d \}. Now if and only if . Furthermore, if and only if . Now one can see that the number of elements of equals the number of elements of A_d^\prime=\{x:1\leq x \leq n/d\quad\text{and}\quad \operatorname{gcd}(x,n/d)=1 \}. Thus by the definition of Euler's phi we have that . As every integer which satisfies belongs in exactly one of the sets , we have that n=\sum_{d \mid n}\varphi \left (\frac{n}{d} \right )=\sum_{d \mid n}\phi (d).

Notation

Sometimes, instead of , is used. This variation of the Greek letter phi is common in textbooks, and is standard usage on the English Wikipedia

See Also

Do you have what it takes to be the next brilliant trader, researcher, or developer at Jane Street Capital? Find out in the Careers in Mathematics Forum.
© Copyright 2008 AoPS Incorporated. All Rights Reserved. • FoundationPrivacyContact Us