Definitions

# Euler's totient function

In number theory, the totient $varphi\left(n\right)$ of a positive integer n is defined to be the number of positive integers less than or equal to n that are coprime to n. For example, $varphi\left(9\right)=6$ since the six numbers 1, 2, 4, 5, 7 and 8 are coprime to 9. The function $varphi$ so defined is the totient function. The totient is 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 it is commonly denoted by the Greek letter Phi ($varphi$). The cototient of n is defined as $n - varphi\left(n\right)$; the number of positive integers less than or equal to n that are not coprime to n.

The totient function is important mainly because it gives the size of the multiplicative group of integers modulo n. More precisely, $varphi\left(n\right)$ is the order of the group of units of the ring $mathbb\left\{Z\right\}/nmathbb\left\{Z\right\}$. This fact, together with Lagrange's theorem, provides a proof for Euler's theorem.

## Computing Euler's function

It follows from the definition that $varphi\left(1\right)=1$, and if p is prime, then $varphi\left(p^\left\{k\right\}\right) = \left(p - 1\right)p^\left\{k - 1\right\}$. Moreover, $varphi$ is a multiplicative function; if m and n are coprime then $varphi\left(mn\right) = varphi\left(m\right) varphi\left(n\right)$. (Sketch of proof: let A, B, C be the sets of residue classes modulo-and-coprime-to m, n, mn respectively; then there is a bijection between A × B and C, via the Chinese remainder theorem.) The value of $varphi\left(n\right)$ can thus be computed using the fundamental theorem of arithmetic: if

$n = p_1^\left\{k_1\right\} cdots p_r^\left\{k_r\right\}$

where the pj are distinct primes, then

$varphi\left(n\right)=\left(p_\left\{1\right\}-1\right)p_\left\{1\right\}^\left\{k_\left\{1\right\}-1\right\} cdots \left(p_\left\{r\right\}-1\right)p_\left\{r\right\}^\left\{k_\left\{r\right\}-1\right\}.$

This last formula is an Euler product and is often written as

$varphi\left(n\right)=nprod_\left\{p|n\right\}left\left(1-frac\left\{1\right\}\left\{p\right\}right\right)$

with the product ranging only over the distinct primes p dividing n.

### Computing example

$varphi\left(36\right)=varphileft\left(3^2 2^2right\right)=36left\left(1-frac\left\{1\right\}\left\{3\right\}right\right)left\left(1-frac\left\{1\right\}\left\{2\right\}right\right)=36cdotfrac\left\{2\right\}\left\{3\right\}cdotfrac\left\{1\right\}\left\{2\right\}=12.$

In words, this says that the distinct prime factors of 36 are 2 and 3; half of the thirty-six integers from 1 to 36 are divisible by 2, leaving eighteen; a third of those are divisible by 3, leaving twelve coprime to 36. And indeed there are twelve: 1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, and 35.

## Some values of the function

 $varphi\left(n\right)$ +0 0+ 10+ 20+ 30+ 40+ 50+ 60+ 70+ +1 +2 +3 +4 +5 +6 +7 +8 +9 1 1 2 2 4 2 6 4 6 4 10 4 12 6 8 8 16 6 18 8 12 10 22 8 20 12 18 12 28 8 30 16 20 16 24 12 36 18 24 16 40 12 42 20 24 22 46 16 42 20 32 24 52 18 40 24 36 28 58 16 60 30 36 32 48 20 66 32 44 24 70 24 72 36 40 36 60 24 78 32 54 40 82 24 64 42 56 40 88 24 72 44 60 46 72 32 96 42 60

## Properties

The number $varphi\left(n\right)$ is also equal to the number of possible generators of the cyclic group Cn (and therefore also to the degree of the cyclotomic polynomial $varphi_n$). Since every element of Cn generates a cyclic subgroup and the subgroups of Cn are of the form Cd where d divides n (written as d | n), we get

$sum_\left\{dmid n\right\}varphi\left(d\right)=n$

where the sum extends over all positive divisors d of n.

We can now use the Möbius inversion formula to "invert" this sum and get another formula for $varphi\left(n\right)$:

$varphi\left(n\right)=sum_\left\{dmid n\right\} d cdot mu\left(n/d\right)$

where μ is the usual Möbius function defined on the positive integers.

According to Euler's theorem, if a is coprime to n, that is, gcd(a,n) = 1, then

$a^\left\{varphi\left(n\right)\right\} equiv 1mod n.$

This follows from Lagrange's theorem and the fact that a belongs to the multiplicative group of $mathbb\left\{Z\right\}/nmathbb\left\{Z\right\}$ iff a is coprime to n.

## Generating functions

The two generating functions presented here are both consequences of the fact that

$sum_\left\{d|n\right\} varphi\left(d\right) = n.$

A Dirichlet series involving $varphi$(n) is

$sum_\left\{n=1\right\}^infty frac\left\{varphi\left(n\right)\right\}\left\{n^s\right\}=frac\left\{zeta\left(s-1\right)\right\}\left\{zeta\left(s\right)\right\}.$

where ζ(s) is the Riemann Zeta function. This is derived as follows:

$zeta\left(s\right) sum_\left\{f=1\right\}^infty frac\left\{varphi\left(f\right)\right\}\left\{f^s\right\} = left\left(sum_\left\{g=1\right\}^infty frac\left\{1\right\}\left\{g^s\right\}right\right)left\left(sum_\left\{f=1\right\}^infty frac\left\{varphi\left(f\right)\right\}\left\{f^s\right\}right\right)$
$left\left(sum_\left\{g=1\right\}^infty frac\left\{1\right\}\left\{g^s\right\}right\right)left\left(sum_\left\{f=1\right\}^infty frac\left\{varphi\left(f\right)\right\}\left\{f^s\right\}right\right) = sum_\left\{h=1\right\}^infty left\left(sum_\left\{fg=h\right\} 1*varphi\left(g\right)right\right) frac\left\{1\right\}\left\{h^s\right\}$
$sum_\left\{h=1\right\}^infty left\left(sum_\left\{fg=h\right\} varphi\left(g\right)right\right) frac\left\{1\right\}\left\{h^s\right\} = sum_\left\{h=1\right\}^infty left\left(sum_\left\{d|h\right\} varphi\left(d\right)right\right) frac\left\{1\right\}\left\{h^s\right\}$
$sum_\left\{h=1\right\}^infty left\left(sum_\left\{d|h\right\} varphi\left(d\right)right\right) frac\left\{1\right\}\left\{h^s\right\} = sum_\left\{h=1\right\}^infty frac\left\{h\right\}\left\{h^s\right\}$
$sum_\left\{h=1\right\}^infty frac\left\{h\right\}\left\{h^s\right\} = zeta\left(s-1\right)$

A Lambert series generating function is

$sum_\left\{n=1\right\}^\left\{infty\right\} frac\left\{varphi\left(n\right) q^n\right\}\left\{1-q^n\right\}= frac\left\{q\right\}\left\{\left(1-q\right)^2\right\}$

which converges for |q|<1.

This follows from

$sum_\left\{n=1\right\}^\left\{infty\right\} frac\left\{varphi\left(n\right) q^n\right\}\left\{1-q^n\right\} =$
sum_{n=1}^{infty} varphi(n) sum_{rge 1} q^{rn}

which is


sum_{kge 1} q^k sum_{n|k} varphi(n) = sum_{kge 1} k q^k = frac{q}{(1-q)^2}.

## Growth of the function

The growth of $varphi\left(n\right)$ as a function of n is an interesting question, since the first impression from small n that $varphi\left(n\right)$ might be noticeably smaller than n is somewhat misleading. Asymptotically we have

for any given ε > 0 and n > N(ε). In fact if we consider

$,varphi\left(n\right)/n,$

we can write that, from the formula above, as the product of factors

$1-p^\left\{-1\right\},$

taken over the prime numbers p dividing n. Therefore the values of n corresponding to particularly small values of the ratio are those n that are the product of an initial segment of the sequence of all primes. From the prime number theorem it can be shown that a constant ε in the formula above can therefore be replaced by

$C,log log n/ log n.$

$varphi$ is also generally close to n in an average sense:

$frac\left\{1\right\}\left\{n^2\right\} sum_\left\{k=1\right\}^n varphi\left(k\right)= frac\left\{3\right\}\left\{pi^2\right\} + mathcal\left\{O\right\}left\left(frac\left\{log n \right\}\left\{n\right\}right\right)$

where the big O is the Landau symbol. This also says that the probability of two positive integers chosen at random from $\left\{1, 2, ldots , n \right\}$ being relatively prime approaches $frac\left\{6\right\}\left\{pi^2\right\}$ when n tends to infinity. A related result is the average order of $frac\left\{varphi\left(n\right)\right\}\left\{n\right\}$, which is described by


frac{1}{n} sum_{k=1}^n frac{varphi(k)}{k} = frac{6}{pi^2} + mathcal{O}left(frac{log n }{n}right)

Because $frac\left\{6\right\}\left\{pi^2\right\} = frac\left\{1\right\}\left\{zeta\left(2\right)\right\}$, one can also express the formula this way.


frac{1}{n} sum_{k=1}^n frac{varphi(k)}{k} = frac{1}{zeta(2)} + mathcal{O}left(frac{log n }{n}right)

A proof of these formulas may be found here.

## Other formulas involving Euler's function

$;varphileft\left(n^mright\right) = n^\left\{m-1\right\}varphi\left(n\right)text\left\{ for \right\}mge 1$

$forall a in N forall n in N exists l in N \left[\left(a >1 and n > 1\right)rightarrow \left(l|varphi\left(a^n-1\right) and l geq n\right) \right]$

$forall a in N forall n in N exists l in N \left[\left(a >1 and n > 6 and 4 not| n \right)rightarrow \left(l|varphi\left(a^n-1\right) and l geq 2n\right) \right]$

$sum_\left\{d mid n\right\} frac\left\{mu^2\left(d\right)\right\}\left\{varphi\left(d\right)\right\} = frac\left\{n\right\}\left\{varphi\left(n\right)\right\}$

$sum_\left\{1le kle n atop \left(k,n\right)=1\right\}!!k = frac\left\{1\right\}\left\{2\right\}nvarphi\left(n\right)text\left\{ for \right\}n>1$

$sum_\left\{k=1\right\}^nvarphi\left(k\right) = frac\left\{1\right\}\left\{2\right\}left\left(1+ sum_\left\{k=1\right\}^n mu\left(k\right)leftlfloorfrac\left\{n\right\}\left\{k\right\}rightrfloor^2right\right)$

$sum_\left\{k=1\right\}^nfrac\left\{varphi\left(k\right)\right\}\left\{k\right\} = sum_\left\{k=1\right\}^nfrac\left\{mu\left(k\right)\right\}\left\{k\right\}leftlfloorfrac\left\{n\right\}\left\{k\right\}rightrfloor$

$sum_\left\{k=1\right\}^nfrac\left\{k\right\}\left\{varphi\left(k\right)\right\} = mathcal\left\{O\right\}\left(n\right)$

$sum_\left\{k=1\right\}^nfrac\left\{1\right\}\left\{varphi\left(k\right)\right\} = mathcal\left\{O\right\}\left(log\left(n\right)\right)$

$sum_\left\{1le kle n atop \left(k,m\right)=1\right\} 1 = n frac \left\{varphi\left(m\right)\right\}\left\{m\right\} +$
mathcal{O} left (2^{omega(m)} right ),

where m > 1 is a positive integer and ω(m) designates the number of distinct prime factors of m. (This formula counts the number of naturals less than or equal to n and relatively prime to m, additional material is listed among the external links.)

Proofs of some of these identities may be found here.

## Inequalities

Some inequalities involving the $varphi$ function are:


varphi(n) > frac {n} {e^gamma; log log n + frac {3} {log log n}} for n > 2, where γ is Euler's constant,


varphi(n) ge sqrt{frac {n} {2} } for n > 0,

and


varphi(n) ge sqrt{n}text{ for } n > 6.

For prime n, clearly $varphi\left(n\right) = n-1$.

For a composite number n we have


varphi(n) le n-sqrt{n} .

For randomly large n, these bounds still cannot be improved, or to be more precise:

$liminf frac\left\{varphi \left(n\right)\right\}\left\{n\right\}=0 mbox\left\{ and \right\} limsup frac\left\{varphi \left(n\right)\right\}\left\{n\right\}=1.$

A pair of inequalities combining the $varphi$ function and the $sigma$ divisor function are:


frac {6 n^2}{pi^2} < varphi(n) sigma(n) < n^2 mbox{ for } n>1.

The last two are proved on the page on proofs of totient identities.

## Ford's theorem

proved that for every integer k ≥ 2 there is a number m for which the equation φ(x) = m has exactly k solutions; this result had previously been conjectured by Wacław Sierpiński. However, no such m is known for k = 1, and according to Carmichael's totient function conjecture it is believed that in this case no such m exists.