Part of my series explaining the RSA Algorithm
Euler, one of the busiest people in Mathematical history, first demonstrated this function in 1763. He tried to use pi (π) to denote the function but it turns out pi was occupied. In 1801 Gauss suggested that we use phi (𝛗) instead. It was named the ‘Totient Function’ in 1879, by James Joseph Sylvester.

With name and notation settled, let’s look at what it does. A coprime pair is where the greatest common divisor two numbers share is 1. They have no larger common factors; they are relatively prime.
The Totient Function tells us how many coprimes a number has smallest than itself. 9’s smaller coprimes are 1, 2, 4, 5, 7 & 8. 𝛗(9) = 6. But how does it do that?
For prime numbers the Totient value is 1 less than itself. Every number less than a prime number is relatively prime to it. This the definition of a prime number. So for any prime p, 𝛗(p) = p -1. That was simple enough.
For a prime p raised to a power k, the only numbers less than pᵏ which are NOT its coprimes are other multiples of p. This is because p is the only factor in pᵏ.
All pᵏ’s factor can be represented: p, 2p, 3p, …, pᵏ⁻¹p.
pᵏ⁻¹ is necessarily the largest multiple of p greater than or equal to pᵏ because pᵏ⁻¹p = p.
Therefore we know that pᵏ has pᵏ⁻¹ numbers less than it which are not coprime. There are pᵏ integers less than pᵏ. If pᵏ⁻¹ are not coprime, then pᵏ - pᵏ⁻¹ integers are coprime to pᵏ.
For prime powers the formula for counting coprimes less than it is: 𝛗(pᵏ) = pᵏ - pᵏ⁻¹.
For those numbers which are neither prime nor prime powers, we use Euler’s Product Formula. It works as follows.
Solving for n, which has j prime factors, the product formula takes the form:
n x (1 — 1/p₁) x (1 — 1/p₂) x ... x (1 — 1/pⱼ).
For example:
n = 42
> which has 3 prime factors
j = 3
ϕ(42) = ϕ(7 x 2 x 3) = 42 x (1 — 1/7) x (1 — 1/2) x (1 — 1/3) = 12.
ϕ(42) = 12
42’s coprimes are: 1, 5, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41. There are 12 of them, so the product formula method worked. But why?
One of 42’s prime factors is 3. We know that 1 in 3 numbers are a multiple of 3, and the other 2 in 3 are not. So we multiple 42 by 2/3 to give us the count of numbers less than 42 which does not share the factor 3.
Repeating this process for all 42’s primes looks like: 6/7 x 1/2 x 2/3 = 6/21. This gives us the proportion of all numbers less than 42 which share none of its prime factors. To get the count, we can do proportion multiplied by total: 6/21 x 42 = 12.
We can use this as a corroborative proof for prime powers too. We found that for any prime power pᵏ, the totient value is 𝛗(pᵏ) = pᵏ - pᵏ⁻¹.
pᵏ — pᵏ⁻¹
pᵏ — (pᵏ x p⁻¹)
pᵏ — (pᵏ x 1/p)
pᵏ(1 — 1/p)
By rearranging the prime power rule we can see it derives from the same idea of removing those numbers that share none of its prime factors; in the case of prime powers, just the one factor.
You’re equipped to find its value in any case, but why would you want to at all? Euler’s Totient is leaned on heavily when working with Carmichael’s Function, as we saw in our explanation of it in an earlier post. Consequently, it is very important to digital cryptography.
The Totient also has implications for two unsolved conjectures: Lehmer’s Conjecture and Carmichael’s conjecture.
Happy maths-ing.
Hitler's Secret - Rory Clements - [Mar 15, 2026]
Nemesis - Rory Clements - [Mar 15, 2026]
HRV & Me: Taming a messy stressy mind - [Mar 8, 2026]
Nucleus - Rory Clements - [Mar 2, 2026]
Corpus - Rory Clements - [Feb 19, 2026]
Resonance - [Feb 8, 2026]
A Night to Remember: Sinking of the Titanic - Walter Lord - [Jan 16, 2026]
Everything I've read in 2026 (so far) - [Jan 1, 2026]
Someone from the Past (British Library Crime Classics) - Margot Bennett - [Dec 15, 2025]
Death in Ambush (British Library Crime Classics) - Susan Gilruth - [Dec 1, 2025]
A Cold Wind From Moscow - Rory Clements - [Nov 23, 2025]
The Boleyn Traitor - Philippa Gregory - [Nov 10, 2025]
Death Makes a Prophet (British Library Crime Classics) - John Bude - [Oct 24, 2025]
The Cheltenham Square Murder (British Library Crime Classics) - John Bude - [Oct 13, 2025]
Sussex Downs Murders (British Library Crime Classics) - John Bude - [Oct 4, 2025]
The Lake District Murder (British Library Crime Classics) - John Bude - [Sep 22, 2025]
The Mayor of Casterbridge - Thomas Hardy - [Sep 15, 2025]
The Murder of Roger Ackroyd - Agatha Christie - [Sep 10, 2025]
Marble Hall Murders - Anthony Horowitz - [Aug 30, 2025]
Where Angels Fear to Tread -- EM Forster - [Jul 25, 2025]
Steve Jobs -- Walter Isaacson - [Jul 10, 2025]
The Fifth Risk -- Michael Lewis - [Jul 10, 2025]
The Ride of a Lifetime -- Bob Iger - [Jul 10, 2025]
James -- Percival Everett - [Jul 3, 2025]
Great Expectations -- Charles Dickens - [Jul 1, 2025]
Hillbilly Elegy -- JD Vance - [Jun 23, 2025]
Principles - [Jun 10, 2025]
Revenge of the Tipping Point -- Malcolm Gladwell - [Jun 9, 2025]
The Grand Babylon Hotel -- Arnold Bennett - [Jun 6, 2025]
The Seven Husbands of Evelyn Hugo -- Taylor Jenkins Reid - [Jun 4, 2025]
Rebecca -- Daphne du Maurier - [Jun 3, 2025]
A Promised Land - Barack Obama - [May 29, 2025]
Less - Andrew Sean Greer - [May 29, 2025]
Careless People - Sarah Wynn-Williams - [May 13, 2025]
Looking Glass War - John Le Carre - [May 7, 2025]
A Murder of Quality - John Le Carre - [May 4, 2025]
London Marathon 2025: Training Retrospective - [May 1, 2025]
The Human Factor - Graham Greene - [Apr 29, 2025]
London Marathon 2025: Race Review - [Apr 28, 2025]
Photos: London Marathon 2025 - [Apr 27, 2025]
Spectating the London Marathon 2025 [Sunday 27th April] - [Apr 27, 2025]
London Marathon 2025: Week 16 - [Apr 26, 2025]
Call for the Dead - John Le Carre - [Apr 23, 2025]
London Marathon 2025: Week 15 - [Apr 21, 2025]
The Manchurian Candidate - Richard Condon - [Apr 16, 2025]
London Marathon 2025: Week 14 - [Apr 13, 2025]
London Marathon 2025: Week 13 - [Apr 5, 2025]
London Marathon 2025: Week 12 - [Mar 30, 2025]
Effortless - Greg Mckeown - [Mar 26, 2025]
Leading - [Mar 26, 2025]
London Marathon 2025: Week 11 - [Mar 23, 2025]
London Marathon 2025: Week 10 - [Mar 16, 2025]
London Marathon 2025: Week 9 - [Mar 9, 2025]
London Marathon 2025: Week 8 - [Mar 2, 2025]
London Marathon 2025: Week 7 - [Feb 22, 2025]
London Marathon 2025: Week 6 - [Feb 16, 2025]
Problems & [Meta] Problem Solving - [Feb 16, 2025]
Little Dribbling - Bill Bryson - [Feb 14, 2025]
Bring Up the Bodies - Hilary Mantel - [Feb 10, 2025]
London Marathon 2025: Week 5 - [Feb 9, 2025]
Three Zero - [Feb 9, 2025]
The iPad mini has genuinely changed my life [no hyperbole] - [Feb 3, 2025]
London Marathon 2025: Week 4 - [Feb 2, 2025]
Coming AI: Valuing Humans in a world where they have no economic value - [Jan 28, 2025]
Value & Price - [Jan 28, 2025]
The Vegetarian - Han Kang - [Jan 27, 2025]
Wolf Hall - Hilary Mantel - [Jan 27, 2025]
London Marathon 2025: Week 3 - [Jan 26, 2025]
Deriving my own proof for Unitary matrices - [Jan 19, 2025]
London Marathon 2025: Week 2 - [Jan 19, 2025]
David Copperfield - Charles Dickens - [Jan 17, 2025]
London Marathon 2025: Week 1 - [Jan 12, 2025]
NYC & DC '24 - [Jan 9, 2025]
Linear Algebra Playground - [Jan 8, 2025]
Configuring an IKEA wireless light switch: Saving you the pain - [Jan 7, 2025]
Goals & Goal-setting - [Jan 7, 2025]
Organisation - [Jan 7, 2025]
Digital Feeds - [Jan 6, 2025]
London Marathon 2025: Training Begins - [Jan 5, 2025]
Everything I've read in 2025 - [Jan 1, 2025]