A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Euler's Totient Function

Graduate Depth 78 in the knowledge graph ☐ I know this ☆ Set as goal
38topics build on this
376prerequisites beneath it
See this on the map →
Modular Arithmetic and CongruencesArithmetic Functions and Multiplicativity→→Carmichael Function and Carmichael NumbersCryptographic Applications: RSA+2 more
euler-phi coprime-integers multiplicative-function

Core Idea

Euler's totient function φ(n) counts the positive integers up to n that are coprime to n. This function is multiplicative with a closed form φ(n) = n∏_{p|n}(1−1/p), making it central to many number-theoretic algorithms, cryptographic systems, and applications of Fermat's Little Theorem.

Explainer

You already know modular arithmetic: working with remainders, and the idea that two numbers are coprime when they share no common factor other than 1. Euler's totient function φ(n) puts a precise count on how many integers from 1 to n are coprime to n. For example, φ(9) asks: how many of 1, 2, 3, 4, 5, 6, 7, 8 share no factor with 9? Since 9 = 3², the only multiples of 3 in range are 3 and 6. That leaves 6 integers, so φ(9) = 6. For a prime p, every number from 1 to p−1 is coprime to p, giving φ(p) = p − 1 — a clean formula with major downstream consequences.

The deeper power of φ comes from its multiplicative structure: if gcd(m, n) = 1, then φ(mn) = φ(m)φ(n). This means you never have to count coprime integers directly for large numbers. Instead, factor n into prime powers, compute φ for each piece, and multiply. The product formula φ(n) = n∏_{p|n}(1 − 1/p) makes this mechanical. For n = 12 = 2² · 3: φ(12) = 12 · (1 − 1/2) · (1 − 1/3) = 12 · 1/2 · 2/3 = 4. Indeed, only 1, 5, 7, 11 are coprime to 12 — exactly four values.

The reason φ appears everywhere is Euler's theorem: if gcd(a, n) = 1, then a^φ(n) ≡ 1 (mod n). This generalizes Fermat's Little Theorem, which is the special case where n is prime. Euler's theorem says that when you repeatedly multiply a by itself in modular arithmetic, you return to 1 after exactly φ(n) steps. This periodicity is the mathematical engine behind RSA cryptography: encoding and decoding messages amounts to raising numbers to carefully chosen exponents modulo n, and φ(n) controls the cycle length that makes decryption work.

Think of φ(n) as measuring how "rich" the multiplicative structure of ℤ/nℤ is. The integers from 1 to n that are coprime to n are exactly the units of ℤ/nℤ — the elements with multiplicative inverses mod n. φ(n) is the size of this group of units. When n is prime, every nonzero element has an inverse, giving the fullest possible structure. Understanding φ(n) is therefore understanding the symmetry of modular arithmetic, and it sits at the intersection of elementary number theory, abstract algebra, and cryptography.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Set Operations: Union, Intersection, and Complement → Proof by Cases → Proving by Cases and Exhaustion → Vacuous Truth and Trivial Cases → Proof by Cases (Proof by Exhaustion) → Mathematical Induction → Divisibility and Greatest Common Divisor → The Fundamental Theorem of Arithmetic → Fundamental Theorem of Arithmetic (Rigorous) → Arithmetic Functions and Multiplicativity → Euler's Totient Function

Longest path: 79 steps · 376 total prerequisite topics

Prerequisites (2)

Leads To (4)