Prime numbers #
This file deals with the factors of natural numbers.
Important declarations #
Nat.primeFactorsList n: the prime factorization ofnNat.primeFactorsList_unique: uniqueness of the prime factorisation
@[irreducible]
primeFactorsList n is the prime factorization of n, listed in increasing order.
Instances For
@[irreducible]
@[irreducible]
@[irreducible]
theorem
Nat.isChain_cons_primeFactorsList
{n a : ℕ}
:
(∀ (p : ℕ), Prime p → p ∣ n → a ≤ p) → List.IsChain (fun (x1 x2 : ℕ) => x1 ≤ x2) (a :: n.primeFactorsList)
theorem
Nat.isChain_two_cons_primeFactorsList
(n : ℕ)
:
List.IsChain (fun (x1 x2 : ℕ) => x1 ≤ x2) (2 :: n.primeFactorsList)
theorem
Nat.isChain_primeFactorsList
(n : ℕ)
:
List.IsChain (fun (x1 x2 : ℕ) => x1 ≤ x2) n.primeFactorsList
theorem
Nat.primeFactorsList_add_two
(n : ℕ)
:
(n + 2).primeFactorsList = (n + 2).minFac :: ((n + 2) / (n + 2).minFac).primeFactorsList
primeFactorsList can be constructed inductively by extracting minFac, for sufficiently
large n.
@[simp]
theorem
Nat.eq_of_perm_primeFactorsList
{a b : ℕ}
(ha : a ≠ 0)
(hb : b ≠ 0)
(h : a.primeFactorsList.Perm b.primeFactorsList)
:
a = b
theorem
Nat.mem_primeFactorsList_iff_dvd
{n p : ℕ}
(hn : n ≠ 0)
(hp : Prime p)
:
p ∈ n.primeFactorsList ↔ p ∣ n
@[simp]
theorem
Nat.primeFactorsList_unique
{n : ℕ}
{l : List ℕ}
(h₁ : l.prod = n)
(h₂ : ∀ p ∈ l, Prime p)
:
l.Perm n.primeFactorsList
Fundamental theorem of arithmetic
theorem
Nat.Prime.primeFactorsList_pow
{p : ℕ}
(hp : Prime p)
(n : ℕ)
:
(p ^ n).primeFactorsList = List.replicate n p
theorem
Nat.eq_prime_pow_of_unique_prime_dvd
{n p : ℕ}
(hpos : n ≠ 0)
(h : ∀ {d : ℕ}, Prime d → d ∣ n → d = p)
:
n = p ^ n.primeFactorsList.length
theorem
Nat.perm_primeFactorsList_mul
{a b : ℕ}
(ha : a ≠ 0)
(hb : b ≠ 0)
:
(a * b).primeFactorsList.Perm (a.primeFactorsList ++ b.primeFactorsList)
For positive a and b, the prime factors of a * b are the union of those of a and b
theorem
Nat.perm_primeFactorsList_mul_of_coprime
{a b : ℕ}
(hab : a.Coprime b)
:
(a * b).primeFactorsList.Perm (a.primeFactorsList ++ b.primeFactorsList)
For coprime a and b, the prime factors of a * b are the union of those of a and b
theorem
Nat.primeFactorsList_sublist_right
{n k : ℕ}
(h : k ≠ 0)
:
n.primeFactorsList.Sublist (n * k).primeFactorsList
theorem
Nat.primeFactorsList_sublist_of_dvd
{n k : ℕ}
(h : n ∣ k)
(h' : k ≠ 0)
:
n.primeFactorsList.Sublist k.primeFactorsList
theorem
Nat.primeFactorsList_subset_right
{n k : ℕ}
(h : k ≠ 0)
:
n.primeFactorsList ⊆ (n * k).primeFactorsList
theorem
Nat.dvd_of_primeFactorsList_subperm
{a b : ℕ}
(ha : a ≠ 0)
(h : a.primeFactorsList.Subperm b.primeFactorsList)
:
a ∣ b
theorem
Nat.replicate_subperm_primeFactorsList_iff
{a b n : ℕ}
(ha : Prime a)
(hb : b ≠ 0)
:
(List.replicate n a).Subperm b.primeFactorsList ↔ a ^ n ∣ b
theorem
Nat.mem_primeFactorsList_mul
{a b : ℕ}
(ha : a ≠ 0)
(hb : b ≠ 0)
{p : ℕ}
:
p ∈ (a * b).primeFactorsList ↔ p ∈ a.primeFactorsList ∨ p ∈ b.primeFactorsList
theorem
Nat.coprime_primeFactorsList_disjoint
{a b : ℕ}
(hab : a.Coprime b)
:
a.primeFactorsList.Disjoint b.primeFactorsList
The sets of factors of coprime a and b are disjoint
theorem
Nat.mem_primeFactorsList_mul_of_coprime
{a b : ℕ}
(hab : a.Coprime b)
(p : ℕ)
:
p ∈ (a * b).primeFactorsList ↔ p ∈ a.primeFactorsList ∪ b.primeFactorsList
theorem
Nat.mem_primeFactorsList_mul_left
{p a b : ℕ}
(hpa : p ∈ a.primeFactorsList)
(hb : b ≠ 0)
:
p ∈ (a * b).primeFactorsList
If p is a prime factor of a then p is also a prime factor of a * b for any b > 0
theorem
Nat.mem_primeFactorsList_mul_right
{p a b : ℕ}
(hpb : p ∈ b.primeFactorsList)
(ha : a ≠ 0)
:
p ∈ (a * b).primeFactorsList
If p is a prime factor of b then p is also a prime factor of a * b for any a > 0