Divisor Finsets #
This file defines sets of divisors of a natural number. This is particularly useful as background for defining Dirichlet convolution.
Main Definitions #
Let n : ℕ
. All of the following definitions are in the Nat
namespace:
divisors n
is theFinset
of natural numbers that dividen
.properDivisors n
is theFinset
of natural numbers that dividen
, other thann
.divisorsAntidiagonal n
is theFinset
of pairs(x,y)
such thatx * y = n
.Perfect n
is true whenn
is positive and the sum ofproperDivisors n
isn
.
Implementation details #
divisors 0
,properDivisors 0
, anddivisorsAntidiagonal 0
are defined to be∅
.
Tags #
divisors, perfect numbers
divisors n
is the Finset
of divisors of n
. As a special case, divisors 0 = ∅
.
Equations
- n.divisors = Finset.filter (fun (d : ℕ) => d ∣ n) (Finset.Ico 1 (n + 1))
Instances For
properDivisors n
is the Finset
of divisors of n
, other than n
.
As a special case, properDivisors 0 = ∅
.
Equations
- n.properDivisors = Finset.filter (fun (d : ℕ) => d ∣ n) (Finset.Ico 1 n)
Instances For
divisorsAntidiagonal n
is the Finset
of pairs (x,y)
such that x * y = n
.
As a special case, divisorsAntidiagonal 0 = ∅
.
Equations
- n.divisorsAntidiagonal = Finset.filter (fun (x : ℕ × ℕ) => x.1 * x.2 = n) (Finset.Ico 1 (n + 1) ×ˢ Finset.Ico 1 (n + 1))
Instances For
@[simp]
theorem
Nat.filter_dvd_eq_divisors
{n : ℕ}
(h : n ≠ 0)
:
Finset.filter (fun (d : ℕ) => d ∣ n) (Finset.range n.succ) = n.divisors
@[simp]
theorem
Nat.filter_dvd_eq_properDivisors
{n : ℕ}
(h : n ≠ 0)
:
Finset.filter (fun (d : ℕ) => d ∣ n) (Finset.range n) = n.properDivisors
theorem
Nat.cons_self_properDivisors
{n : ℕ}
(h : n ≠ 0)
:
Finset.cons n n.properDivisors ⋯ = n.divisors
theorem
Nat.divisors_filter_dvd_of_dvd
{n : ℕ}
{m : ℕ}
(hn : n ≠ 0)
(hm : m ∣ n)
:
Finset.filter (fun (d : ℕ) => d ∣ m) n.divisors = m.divisors
See also Nat.mem_properDivisors
.
@[simp]
theorem
Nat.map_swap_divisorsAntidiagonal
{n : ℕ}
:
Finset.map (Equiv.prodComm ℕ ℕ).toEmbedding n.divisorsAntidiagonal = n.divisorsAntidiagonal
@[simp]
theorem
Nat.image_fst_divisorsAntidiagonal
{n : ℕ}
:
Finset.image Prod.fst n.divisorsAntidiagonal = n.divisors
@[simp]
theorem
Nat.image_snd_divisorsAntidiagonal
{n : ℕ}
:
Finset.image Prod.snd n.divisorsAntidiagonal = n.divisors
theorem
Nat.map_div_right_divisors
{n : ℕ}
:
Finset.map { toFun := fun (d : ℕ) => (d, n / d), inj' := ⋯ } n.divisors = n.divisorsAntidiagonal
theorem
Nat.map_div_left_divisors
{n : ℕ}
:
Finset.map { toFun := fun (d : ℕ) => (n / d, d), inj' := ⋯ } n.divisors = n.divisorsAntidiagonal
theorem
Nat.divisors_prime_pow
{p : ℕ}
(pp : Nat.Prime p)
(k : ℕ)
:
(p ^ k).divisors = Finset.map { toFun := fun (x : ℕ) => p ^ x, inj' := ⋯ } (Finset.range (k + 1))
@[simp]
theorem
Nat.Prime.sum_properDivisors
{α : Type u_1}
[AddCommMonoid α]
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
∑ x ∈ p.properDivisors, f x = f 1
@[simp]
theorem
Nat.Prime.prod_properDivisors
{α : Type u_1}
[CommMonoid α]
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
∏ x ∈ p.properDivisors, f x = f 1
@[simp]
theorem
Nat.Prime.sum_divisors
{α : Type u_1}
[AddCommMonoid α]
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
@[simp]
theorem
Nat.Prime.prod_divisors
{α : Type u_1}
[CommMonoid α]
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
theorem
Nat.properDivisors_prime_pow
{p : ℕ}
(pp : Nat.Prime p)
(k : ℕ)
:
(p ^ k).properDivisors = Finset.map { toFun := fun (x : ℕ) => p ^ x, inj' := ⋯ } (Finset.range k)
@[simp]
theorem
Nat.sum_properDivisors_prime_nsmul
{α : Type u_1}
[AddCommMonoid α]
{k : ℕ}
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
∑ x ∈ (p ^ k).properDivisors, f x = ∑ x ∈ Finset.range k, f (p ^ x)
@[simp]
theorem
Nat.prod_properDivisors_prime_pow
{α : Type u_1}
[CommMonoid α]
{k : ℕ}
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
∏ x ∈ (p ^ k).properDivisors, f x = ∏ x ∈ Finset.range k, f (p ^ x)
@[simp]
theorem
Nat.sum_divisors_prime_pow
{α : Type u_1}
[AddCommMonoid α]
{k : ℕ}
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
∑ x ∈ (p ^ k).divisors, f x = ∑ x ∈ Finset.range (k + 1), f (p ^ x)
@[simp]
theorem
Nat.prod_divisors_prime_pow
{α : Type u_1}
[CommMonoid α]
{k : ℕ}
{p : ℕ}
{f : ℕ → α}
(h : Nat.Prime p)
:
∏ x ∈ (p ^ k).divisors, f x = ∏ x ∈ Finset.range (k + 1), f (p ^ x)
theorem
Nat.primeFactors_eq_to_filter_divisors_prime
(n : ℕ)
:
n.primeFactors = Finset.filter (fun (p : ℕ) => Nat.Prime p) n.divisors
The factors of n
are the prime divisors
@[deprecated Nat.primeFactors_eq_to_filter_divisors_prime]
theorem
Nat.prime_divisors_eq_to_filter_divisors_prime
(n : ℕ)
:
n.primeFactors = Finset.filter (fun (p : ℕ) => Nat.Prime p) n.divisors
Alias of Nat.primeFactors_eq_to_filter_divisors_prime
.
The factors of n
are the prime divisors
theorem
Nat.primeFactors_filter_dvd_of_dvd
{m : ℕ}
{n : ℕ}
(hn : n ≠ 0)
(hmn : m ∣ n)
:
Finset.filter (fun (p : ℕ) => p ∣ m) n.primeFactors = m.primeFactors
@[deprecated Nat.primeFactors_filter_dvd_of_dvd]
theorem
Nat.prime_divisors_filter_dvd_of_dvd
{m : ℕ}
{n : ℕ}
(hn : n ≠ 0)
(hmn : m ∣ n)
:
Finset.filter (fun (p : ℕ) => p ∣ m) n.primeFactors = m.primeFactors
Alias of Nat.primeFactors_filter_dvd_of_dvd
.
@[simp]
theorem
Nat.image_div_divisors_eq_divisors
(n : ℕ)
:
Finset.image (fun (x : ℕ) => n / x) n.divisors = n.divisors