Lably
Skip to content

Euler's totient function

Number of integers coprime to and less than n

  • 12 min read
  • 11 chapters
  • 6 labs on Lably

Learn it on Lably

For example, the totatives of n=9 are the six numbers 1, 2, 4, 5, 7 and 8. They are all relatively prime to 9, but the other three numbers in this range, 3, 6, and 9 are not, since gcd(9,3)=gcd(9,6)=3 and gcd(9,9)=9. Therefore, φ(9)=6. As another example, φ(1)=1 since for n=1 the only integer in the range from 1 to n is 1 itself, and gcd(1,1)=1.

Euler's totient function is a multiplicative function, meaning that if two numbers m and n are relatively prime, then φ(mn)=φ(m)φ(n). This function gives the order of the multiplicative group of integers modulo n (the group of units of the ring Z/nZ). It is also used for defining the RSA encryption system.

History, terminology, and notation

Leonhard Euler introduced the function in 1763. However, he did not at that time choose any specific symbol to denote it. In a 1784 publication, Euler studied the function further, choosing the Greek letter π to denote it: he wrote πD for "the multitude of numbers less than D, and which have no common divisor with it". This definition varies from the current definition for the totient function at D=1 but is otherwise the same. The now-standard notation φ(A) comes from Gauss's 1801 treatise Disquisitiones Arithmeticae, although Gauss did not use parentheses around the argument and wrote φA. Thus, it is often called Euler's phi function or simply the phi function.

In 1879, J. J. Sylvester coined the term totient for this function, so it is also referred to as Euler's totient function, the Euler totient, or Euler's totient. Jordan's totient is a generalization of Euler's.

The cototient of n is defined as n−φ(n). It counts the number of positive integers less than or equal to n that have at least one prime factor in common with n.

Sign in to keep reading

10 more chapters are free with a Lably account.

More in Functions