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.CarmichaelNumber

18 declarations. Mathlib docs · Source

Carmichael numbers

This file defines Carmichael numbers and proves Korselt's criterion about them.

Main definitions

  • Nat.IsCarmichael: a predicate for Carmicheal numbers

Main results

  • Nat.isCarmichael_iff_korselt: Korselt's criterion for Carmichael numbers
  • Nat.isCarmichael_561: 561 is a Carmichael number

TODO

  • Prove (in a computationally efficient manner) that there are no Carmichael numbers less than 561.

References

https://en.wikipedia.org/wiki/Carmichael_number

def Nat.IsCarmichael E3 #

ℕ → Prop

We say a natural number n is a Carmichael number if it is greater than 2, composite and for all natural numbers b coprime to n we have n ∣ b ^ (n - 1) - 1.

theorem Nat.IsCarmichael.two_lt E1 #

∀ {n : ℕ}, n.IsCarmichael → 2 < n

theorem Nat.IsCarmichael.neZero E1 #

∀ {n : ℕ}, n.IsCarmichael → NeZero n

theorem Nat.IsCarmichael.not_prime E1 #

∀ {n : ℕ}, n.IsCarmichael → ¬Nat.Prime n

theorem Nat.IsCarmichael.probablePrime_of_coprime E1 #

∀ {n b : ℕ}, n.IsCarmichael → b.Coprime n → n.ProbablePrime b

theorem Nat.Prime.not_isCarmichael E1 #

∀ {n : ℕ}, Nat.Prime n → ¬n.IsCarmichael

theorem Nat.not_isCarmichael_zero E0 #

¬Nat.IsCarmichael 0

theorem Nat.not_isCarmichael_one E0 #

¬Nat.IsCarmichael 1

theorem Nat.IsCarmichael.zmod_unit_pow_sub_one E1 #

∀ {n : ℕ} (s : (ZMod n)ˣ), n.IsCarmichael → s ^ (n - 1) = 1

theorem Nat.IsCarmichael.odd E1 #

∀ {n : ℕ}, n.IsCarmichael → Odd n

A Carmichael number is odd.

theorem Nat.IsCarmichael.squarefree E1 #

∀ {n : ℕ}, n.IsCarmichael → Squarefree n

A Carmichael number is squarefree.

theorem Nat.IsCarmichael.carmichael_dvd_sub_one E1 #

∀ {n : ℕ}, n.IsCarmichael → ArithmeticFunction.carmichael n ∣ n - 1

theorem Nat.IsCarmichael.prime_sub_one_dvd E1 #

∀ {n p : ℕ}, n.IsCarmichael → Nat.Prime p → p ∣ n → p - 1 ∣ n - 1

theorem Nat.isCarmichael_iff_korselt E3 #

∀ {n : ℕ}, n.IsCarmichael ↔ 2 < n ∧ ¬Nat.Prime n ∧ Squarefree n ∧ ∀ (p : ℕ), Nat.Prime p → p ∣ n → p - 1 ∣ n - 1

Korselt's criterion for Carmichael numbers: n is a Carmichael number if and only if it is greater than two, composite, squarefree, and for each prime divisor p of n, we have p - 1 ∣ n - 1.

theorem Nat.IsCarmichael.three_le_card_primeFactors E1 #

∀ {n : ℕ}, n.IsCarmichael → 3 ≤ n.primeFactors.card

theorem Nat.isCarmichael_iff_korselt_primeFactorsList E2 #

∀ {n : ℕ}, n.IsCarmichael ↔ 2 < n ∧ ¬Nat.Prime n ∧ n.primeFactorsList.Nodup ∧ ∀ p ∈ n.primeFactorsList, p - 1 ∣ n - 1

Korselt's criterion stated in a form suitable for concrete calculations.

theorem Nat.isCarmichael_561 E3 #

Nat.IsCarmichael 561

561 is a Carmichael number.

theorem Nat.isCarmichael_1105 E1 #

Nat.IsCarmichael 1105

1105 is a Carmichael number.