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

Carmichael Function and Carmichael Numbers

Graduate Depth 87 in the knowledge graph ☐ I know this ☆ Set as goal
7topics build on this
398prerequisites beneath it
See this on the map →
Euler's Totient FunctionFermat's Little Theorem→→Modular Arithmetic and CongruencesThe Chinese Remainder Theorem and Its Applications
number-theory carmichael prime-testing

Core Idea

The Carmichael function λ(n) is the exponent of the multiplicative group modulo n. Carmichael numbers are composite numbers n where aⁿ⁻¹ ≡ 1 (mod n) for all a coprime to n, making them pseudoprimes to all bases. Understanding them is essential for probabilistic primality testing.

Explainer

You already know Euler's totient function φ(n), which counts how many integers from 1 to n are coprime to n. You also know that for any such integer a, the multiplicative order of a modulo n divides φ(n) — meaning a^φ(n) ≡ 1 (mod n). But φ(n) is often larger than necessary: it counts elements, but what you really want is the smallest exponent that works for *all* of them simultaneously. That smaller value is the Carmichael function λ(n), defined as the exponent of the multiplicative group (ℤ/nℤ)×.

Concretely, λ(n) is the least positive integer m such that am ≡ 1 (mod n) for every a coprime to n. For prime p, λ(p) = p−1 = φ(p), so nothing changes. For prime powers and composites, λ(n) can be a proper divisor of φ(n). For example, λ(12) = 2 even though φ(12) = 4, because every integer coprime to 12 satisfies a² ≡ 1 (mod 12). The formula for λ on prime powers is: λ(2) = 1, λ(4) = 2, λ(2k) = 2k−2 for k ≥ 3, and λ(pk) = pk−1(p−1) for odd primes p. For composite n, λ(n) = lcm of λ over the prime-power factors.

Carmichael numbers arise from a subtle flaw in Fermat's primality test. Fermat's little theorem says ap−1 ≡ 1 (mod p) for all a coprime to p — so if this congruence *fails*, p is definitely composite. The test checks this as a primality certificate. A Carmichael number is a composite n that passes this test for *every* base a coprime to n: an−1 ≡ 1 (mod n) for all gcd(a,n) = 1. The smallest example is 561 = 3 × 7 × 11. Because λ(561) = lcm(2, 6, 10) = 30 divides 560 = n−1, every valid base satisfies the Fermat condition — despite 561 being composite.

The Korselt criterion characterizes Carmichael numbers elegantly: a squarefree composite n is Carmichael if and only if (p−1) | (n−1) for every prime p dividing n. This directly connects the structure of Carmichael numbers to the Carmichael function: the condition guarantees λ(n) | (n−1). Infinitely many Carmichael numbers exist (proved by Alford, Granville, and Pomerance in 1994), which means Fermat's test alone is not a reliable primality test. Modern primality tests like Miller-Rabin specifically address this weakness by choosing bases adversarially and checking additional conditions that Carmichael numbers cannot satisfy for all bases.

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 → Divisibility Theory (Formal Treatment) → Fundamental Theorem of Arithmetic (Rigorous Proof) → Arithmetic Functions and Multiplicativity → Dirichlet Series and L-Functions → Primes in Arithmetic Progressions (Dirichlet's Theorem) → Distribution of Primes → Introduction to the Riemann Zeta Function → Dirichlet Series and L-Functions → Primes in Arithmetic Progressions (Dirichlet's Theorem) → Wilson's Theorem → Fermat's Little Theorem → Carmichael Function and Carmichael Numbers

Longest path: 88 steps · 398 total prerequisite topics

Prerequisites (2)

Leads To (2)