Euler's totient function #
This file defines Euler's totient function
Nat.totient n
which counts the number of naturals less than n
that are coprime with n
.
We prove the divisor sum formula, namely that n
equals φ
summed over the divisors of n
. See
sum_totient
. We also prove two lemmas to help compute totients, namely totient_mul
and
totient_prime_pow
.
Euler's totient function. This counts the number of naturals strictly less than n
which are
coprime with n
.
Equations
- Nat.totient n = (Finset.filter (Nat.Coprime n) (Finset.range n)).card
Instances For
Euler's totient function. This counts the number of naturals strictly less than n
which are
coprime with n
.
Equations
- Nat.termφ = Lean.ParserDescr.node `Nat.termφ 1024 (Lean.ParserDescr.symbol "φ")
Instances For
A characterisation of Nat.totient
that avoids Finset
.
Note this takes an explicit Fintype ((ZMod n)ˣ)
argument to avoid trouble with instance
diamonds.
For d ∣ n
, the totient of n/d
equals the number of values k < n
such that gcd n k = d
Euler's product formula for the totient function #
We prove several different statements of this formula.
Euler's product formula for the totient function.
Euler's product formula for the totient function.
Euler's product formula for the totient function.
Euler's product formula for the totient function.