Skip over navigation
Cambridge University Faculty of Mathematics NRich logo
menu search
  • Teachers expand_more
    • Early years
    • Primary
    • Secondary
    • Post-16
    • Events
    • Professional development
  • Students expand_more
    • Primary
    • Secondary
    • Post-16
  • Parents expand_more
    • Early Years
    • Primary
    • Secondary
    • Post-16
  • Problem-Solving Schools
  • About NRICH expand_more
    • About us
    • Impact stories
    • Support us
    • Our funders
    • Contact us
  • search

Or search by topic

Number and algebra

  • The Number System and Place Value
  • Calculations and Numerical Methods
  • Fractions, Decimals, Percentages, Ratio and Proportion
  • Properties of Numbers
  • Patterns, Sequences and Structure
  • Algebraic expressions, equations and formulae
  • Coordinates, Functions and Graphs

Geometry and measure

  • Angles, Polygons, and Geometrical Proof
  • 3D Geometry, Shape and Space
  • Measuring and calculating with units
  • Transformations and constructions
  • Pythagoras and Trigonometry
  • Vectors and Matrices

Probability and statistics

  • Handling, Processing and Representing Data
  • Probability

Working mathematically

  • Thinking mathematically
  • Developing positive attitudes
  • Cross-curricular contexts

Advanced mathematics

  • Decision Mathematics and Combinatorics
  • Advanced Probability and Statistics
  • Mechanics
  • Calculus

For younger learners

  • Early Years Foundation Stage

Euler's Totient Function

Age 16 to 18
Challenge Level Yellow starYellow star
  • Problem
  • Getting Started
  • Student Solutions
  • Teachers' Resources

 

Question 1: Show that $\phi(15) = 8$.

Rayn, Torsten, Archie, Rupert, Jack, Takumi and Joe from Abingdon, Nayanika from The Tiffin Girls' School, Wiktor from LAE Tottenham, Mohsin from Oasis Academy Hadley and Olivia from Roedean, all in the UK, Ella from Jersey College for Girls in Jersey and Mahdi from Mahatma Gandhi International School in India all found $\phi(15).$ This is Ella's work:

Nayanika showed how to find $\phi(15)$ in a video which also introduces a different famous $\phi$ in mathematics: the golden ratio. Although they are written using the same letter, the golden ratio and Euler's Totient function are not directly related. Click here to see Nayanika's video.

Question 2: Investigate $\phi(p)$ where $p$ is a prime number.  Can you find a general expression for $\phi(p)$?

Rayn, Torsten, Archie, Rupert, Jack, Takumi and Joe, Nayanika, Ella, Wiktor, Mohsin, Mahdi and Olivia found an expression for $\phi (p)$. Rayn, Torsten, Archie, Rupert, Jack, Takumi and Joe sent these examples:

This is Mohsin's work:

Question 3: Investigate $\phi(2^n)$ where $n=1, 2, 3, ...$.  Can you find a general expression for $\phi(2^n)$?  What about $\phi(3^n)$?

Rayn, Torsten, Archie, Rupert, Jack, Takumi and Joe, Wiktor, Mahdi, Olivia and Mohsin tried some examples and found a general expression for $\phi (p^n).$ This is Mahdi's work for $\phi(2^n)$

This is Olivia's work for $\phi (3^n)$ and $\phi (p^n)$:

 

Question 4: Under which conditions is $\phi(nm) = \phi(n) \times \phi(m)$ true?

Nayanika and Ella said that $\phi(nm) = \phi(n) \times \phi(m)$ when $m$ and $n$ are prime. This is Ella's work:

Rayn, Torsten, Archie, Rupert, Jack, Takumi and Joe, Ella, Wiktor, Mohsin, Mahdi and Olivia found that it sometimes works when $m$ and $n$ are not prime. This is Olivia's work, with some notes added to the diagram to support some of the algebra:

Question 5: Can you find a general expression for $\phi(n)$?

Rayn, Torsten, Archie, Rupert, Jack, Takumi and Joe and Ella thought about using prime factorisations. Wiktor, Mohsin, Mahdi and Olivia found an expression for $\phi(n)$ using the prime factorisation of $n.$ This is Wiktor's work:


which is equal to

Rayn, Torsten, Archie, Rupert, Jack, Takumi and Joe wrote a python program which computes Euler's Totient Function:

def totient (x):
  ans=1
  list=[]
  list2=[]
  counter=0
  while x != 1:
    for i in range (2,x+1):
      if x%i==0:
        x=x//i
        if i not in list:
          list.append(i)
        else:
          if counter!=i:
            list2.append(i)
            counter=i
          list2.append(i)
        break
  for i in list2:
    while list.count(i)!=0:
      list.remove(i)
  for item in list:
    ans=ans*(item-1)
  while len(list2)!=0:
    first=list2[0]
    power=list2.count(first)
    ans=ans*(first**power-first**(power-1))
    while list2.count(first)!=0:
      list2.remove(first)
  return ans

a=int(input("input a number:"))
print(f'phi of {a} is {totient(a)}')

In short, list2 contains the prime factorisation of x, and then the function applies the same formula Wiktor found (but using Wiktor's unsimplified formula).

Extension: Fermat Euler Theorem: Under which conditions is it true that $x^{\phi(n)} \equiv 1 \text{ mod }n \; ?$

Mahdi tried out some examples and came up with a conjecture:

Olivia and Wiktor proved it using similar arguments to each other. This is Olivia's proof, which uses ideas from More Adventures with Modular Arithmetic:

Olivia means that when we multiply each of the numbers $a_1, a_2, a_3, ... , a_{\phi(n)}$ by $x,$ each of the products $a_1x, a_2x, a_3x, ... , a_{\phi(n)}x$ will be a different integer less than $n$ which is coprime to $n.$

Therefore $a_1x, a_2x, a_3x, ... , a_{\phi(n)}x$ and $a_1, a_2, a_3, ... , a_{\phi(n)}$ are the same numbers in some order.

Nayanika submitted two more videos which continues from the video at the top of the solution. In this video, Nayanika talks about the golden ratio and the Fibonacci numbers. Click here to see Nayanika's second video. Can you see how the rectangles in the image at the end are connected to the golden ratio?

Click here to see Nayanika's third video.

You may also like

Curvy Equation

This problem asks you to use your curve sketching knowledge to find all the solutions to an equation.

Digital Equation

Can you find a three digit number which is equal to the sum of the hundreds digit, the square of the tens digit and the cube of the units digit?

Frosty the Snowman

Frosty the Snowman is melting. Can you use your knowledge of differential equations to find out how his volume changes as he shrinks?

  • Tech help
  • Accessibility Statement
  • Sign up to our newsletter
  • Twitter X logo

The NRICH Project aims to enrich the mathematical experiences of all learners. To support this aim, members of the NRICH team work in a wide range of capacities, including providing professional development for teachers wishing to embed rich mathematical tasks into everyday classroom practice.

NRICH is part of the family of activities in the Millennium Mathematics Project.

University of Cambridge logo NRICH logo