The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V12. Number theory

Mathlib.NumberTheory.ArithmeticFunction.Carmichael

20 declarations and 1 deprecated aliases. Mathlib docs · Source

def ArithmeticFunction.carmichael E1 #

ArithmeticFunction ℕ

λ is the Carmichael function, also known as the reduced totient function, defined as the exponent of the unit group of ZMod n.

def ArithmeticFunction.carmichael.«termλ» E1 #

Lean.ParserDescr

λ is the Carmichael function, also known as the reduced totient function, defined as the exponent of the unit group of ZMod n.

theorem ArithmeticFunction.carmichael_eq_exponent E1 #

∀ {n : ℕ}, n ≠ 0 → ArithmeticFunction.carmichael n = Monoid.exponent (ZMod n)ˣ

theorem ArithmeticFunction.carmichael_eq_exponent' E1 #

∀ (n : ℕ) [NeZero n], ArithmeticFunction.carmichael n = Monoid.exponent (ZMod n)ˣ

This takes in an NeZero n instance instead of an n ≠ 0 hypothesis.

theorem ArithmeticFunction.pow_carmichael E0 #

∀ {n : ℕ} (a : (ZMod n)ˣ), a ^ ArithmeticFunction.carmichael n = 1

theorem ArithmeticFunction.carmichael_dvd_totient E1 #

∀ (n : ℕ), ArithmeticFunction.carmichael n ∣ n.totient

theorem ArithmeticFunction.carmichael_dvd E1 #

∀ {a b : ℕ}, a ∣ b → ArithmeticFunction.carmichael a ∣ ArithmeticFunction.carmichael b

theorem ArithmeticFunction.carmichael_lcm E1 #

∀ (a b : ℕ),
  ArithmeticFunction.carmichael (a.lcm b) = (ArithmeticFunction.carmichael a).lcm (ArithmeticFunction.carmichael b)

theorem ArithmeticFunction.carmichael_mul E1 #

∀ {a b : ℕ},
  a.Coprime b →
    ArithmeticFunction.carmichael (a * b) = (ArithmeticFunction.carmichael a).lcm (ArithmeticFunction.carmichael b)

theorem ArithmeticFunction.carmichael_finset_lcm E1 #

∀ {α : Type u_1} (s : Finset α) (f : α → ℕ),
  ArithmeticFunction.carmichael (s.lcm f) = s.lcm (⇑ArithmeticFunction.carmichael ∘ f)

theorem ArithmeticFunction.carmichael_finsetProd E1 #

∀ {α : Type u_1} {s : Finset α} {f : α → ℕ},
  (↑s).Pairwise (Function.onFun Nat.Coprime f) →
    ArithmeticFunction.carmichael (s.prod f) = s.lcm (⇑ArithmeticFunction.carmichael ∘ f)

theorem ArithmeticFunction.carmichael_factorization E1 #

∀ (n : ℕ) [NeZero n],
  ArithmeticFunction.carmichael n = n.primeFactors.lcm fun p ↦ ArithmeticFunction.carmichael (p ^ n.factorization p)

theorem ArithmeticFunction.carmichael_two_pow_of_le_two_eq_totient E1 #

∀ {n : ℕ}, n ≤ 2 → ArithmeticFunction.carmichael (2 ^ n) = (2 ^ n).totient

theorem ArithmeticFunction.carmichael_two_pow_of_le_two E0 #

∀ {n : ℕ}, n ≤ 2 → ArithmeticFunction.carmichael (2 ^ n) = 2 ^ (n - 1)

Note that 2 ^ (n - 1) = 1 when n = 0.

theorem ArithmeticFunction.carmichael_two_pow_of_ne_two E0 #

∀ {n : ℕ}, n ≠ 2 → ArithmeticFunction.carmichael (2 ^ n) = 2 ^ (n - 2)

Note that 2 ^ (n - 2) = 1 when n ≤ 1.

theorem ArithmeticFunction.two_mul_carmichael_two_pow_of_three_le_eq_totient E1 #

∀ {n : ℕ}, 3 ≤ n → 2 * ArithmeticFunction.carmichael (2 ^ n) = (2 ^ n).totient

theorem ArithmeticFunction.carmichael_pow_of_prime_ne_two E0 #

∀ {p : ℕ} (n : ℕ), Nat.Prime p → p ≠ 2 → ArithmeticFunction.carmichael (p ^ n) = (p ^ n).totient

theorem ArithmeticFunction.carmichael_one E0 #

ArithmeticFunction.carmichael 1 = 1

theorem ArithmeticFunction.carmichael_two E0 #

ArithmeticFunction.carmichael 2 = 1

theorem ArithmeticFunction.carmichael_of_prime E1 #

∀ {n : ℕ}, Nat.Prime n → ArithmeticFunction.carmichael n = n - 1

Deprecated aliases

NameNew nameSince
ArithmeticFunction.CarmichaelArithmeticFunction.carmichael2026-05-06