Lemmas about squarefreeness of natural numbers #
A number is squarefree when it is not divisible by any squares except the squares of units.
Main Results #
Nat.squarefree_iff_nodup_factors
: A positive natural numberx
is squarefree iff the listfactors x
has no duplicate factors.
Tags #
squarefree, multiplicity
theorem
Nat.squarefree_iff_nodup_factors
{n : ℕ}
(h0 : n ≠ 0)
:
Squarefree n ↔ List.Nodup (Nat.factors n)
theorem
Nat.Squarefree.factorization_le_one
{n : ℕ}
(p : ℕ)
(hn : Squarefree n)
:
↑(Nat.factorization n) p ≤ 1
theorem
Nat.squarefree_of_factorization_le_one
{n : ℕ}
(hn : n ≠ 0)
(hn' : ∀ (p : ℕ), ↑(Nat.factorization n) p ≤ 1)
:
theorem
Nat.squarefree_iff_factorization_le_one
{n : ℕ}
(hn : n ≠ 0)
:
Squarefree n ↔ ∀ (p : ℕ), ↑(Nat.factorization n) p ≤ 1
theorem
Nat.squarefree_pow_iff
{n : ℕ}
{k : ℕ}
(hn : n ≠ 1)
(hk : k ≠ 0)
:
Squarefree (n ^ k) ↔ Squarefree n ∧ k = 1
Returns the smallest prime factor p
of n
such that p^2 ∣ n
, or none
if there is no
such p
(that is, n
is squarefree). See also Nat.squarefree_iff_minSqFac
.
Equations
- Nat.minSqFac n = if 2 ∣ n then let n' := n / 2; if 2 ∣ n' then some 2 else Nat.minSqFacAux n' 3 else Nat.minSqFacAux n 3
Instances For
The correctness property of the return value of minSqFac
.
- If
none
, thenn
is squarefree; - If
some d
, thend
is a minimal square factor ofn
Equations
Instances For
theorem
Nat.minSqFacProp_div
(n : ℕ)
{k : ℕ}
(pk : Nat.Prime k)
(dk : k ∣ n)
(dkk : ¬k * k ∣ n)
{o : Option ℕ}
(H : Nat.MinSqFacProp (n / k) o)
:
Nat.MinSqFacProp n o
theorem
Nat.minSqFacAux_has_prop
{n : ℕ}
(k : ℕ)
(n0 : 0 < n)
(i : ℕ)
(e : k = 2 * i + 3)
(ih : ∀ (m : ℕ), Nat.Prime m → m ∣ n → k ≤ m)
:
Nat.MinSqFacProp n (Nat.minSqFacAux n k)
Equations
- Nat.instDecidablePredNatSquarefreeMonoid x = decidable_of_iff' (Nat.minSqFac x = none) (_ : Squarefree x ↔ Nat.minSqFac x = none)
theorem
Nat.divisors_filter_squarefree_of_squarefree
{n : ℕ}
(hn : Squarefree n)
:
Finset.filter Squarefree (Nat.divisors n) = Nat.divisors n
theorem
Nat.divisors_filter_squarefree
{n : ℕ}
(h0 : n ≠ 0)
:
(Finset.filter Squarefree (Nat.divisors n)).val = Multiset.map (fun x => Multiset.prod x.val)
(Finset.powerset (Multiset.toFinset (UniqueFactorizationMonoid.normalizedFactors n))).val
theorem
Nat.sum_divisors_filter_squarefree
{n : ℕ}
(h0 : n ≠ 0)
{α : Type u_1}
[AddCommMonoid α]
{f : ℕ → α}
:
(Finset.sum (Finset.filter Squarefree (Nat.divisors n)) fun i => f i) = Finset.sum (Finset.powerset (Multiset.toFinset (UniqueFactorizationMonoid.normalizedFactors n))) fun i =>
f (Multiset.prod i.val)
theorem
Nat.squarefree_mul
{m : ℕ}
{n : ℕ}
(hmn : Nat.Coprime m n)
:
Squarefree (m * n) ↔ Squarefree m ∧ Squarefree n
squarefree
is multiplicative. Note that the → direction does not require hmn
and generalizes to arbitrary commutative monoids. See squarefree.of_mul_left
and
squarefree.of_mul_right
above for auxiliary lemmas.
theorem
Nat.squarefree_mul_iff
{m : ℕ}
{n : ℕ}
:
Squarefree (m * n) ↔ Nat.Coprime m n ∧ Squarefree m ∧ Squarefree n
theorem
Nat.prod_factors_toFinset_of_squarefree
{n : ℕ}
(hn : Squarefree n)
:
(Finset.prod (List.toFinset (Nat.factors n)) fun p => p) = n