Euler-Totient Function

Euler-φ Function

For nZ+, let φ(n) be the number of positive integers an with a relatively prime to n. Namely, (a,n)=1 (so you are counting the "primes" up to n).

For example φ(12)=4 since 1,5,7,11 are the only positive integers less than or equal to 12 with no factor in common with 12. Similarly φ(1)=1,φ(2)=1,φ(3)=2,φ(4)=2,.... For primes p we have φ(p)=p1 and more generally for all a1 we have:

φ(pa)=papa1=pa1(p1)

The function φ is multiplicative in the sense that:

φ(ab)=φ(a)φ(b)gcd(a,b)=1

So for any general nN then n=p1α1p2α2psαs so then:

φ(n)=i=1sφ(piαi)=piαi1(pi1)

For instance φ(12)=φ(22)φ(3)=21(21)30(31)=4.