// NUMBER THEORY · ADVANCED
Euler's Totient Functionφ(n) counts the numbers that share no common factor with n. It is the bridge from Fermat to RSA.
Prerequisites: Prime factorization · GCD · Modular arithmetic
// VISUALIZER
Count numbers that share no factor with n
Enter n and watch the sieve. Green cells are coprime to n; red cells share a factor. The total green count is φ(n).
Total
24
Coprime
0
φ(n)
8
Press PLAY to highlight numbers coprime to n in green.
// MINI GAME
Totient Counter
Select every number from 1 to n that is coprime to n. Submit when you think you have found all φ(n) numbers.
Loading numbers...
// FLOWCHART
Algorithm flow
Press PLAY to trace the algorithm through the flowchart.
// PSEUDOCODE
Trace the code
Press PLAY to step through the algorithm line by line.
// TUTORIAL QUIZZES
Test your mastery
From counting coprimes to the product formula and RSA.
// PRACTICE & ASSESS
Test your understanding
Now that you've learned the concept, put it into practice. Solve coding problems and take quizzes to reinforce what you've learned.
// REFERENCES
Sources & further reading
- [1]Introductio in analysin infinitorumLeonhard Euler — introduced the totient function
- [2]Disquisitiones ArithmeticaeCarl Friedrich Gauss — number-theoretic foundations
- [3]Introduction to Algorithms (CLRS)T. H. Cormen et al. — number-theoretic algorithms
- [4]A Course in Number Theory and CryptographyNeal Koblitz — RSA and Euler totient
// READY?
Six number-theory tutorials are live
From GCD to Euler's Totient, each page has animations, games, quizzes, and full SEO. Dive into the hub to explore them all.