File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ theorem primeFactorsList_eq_nil (n : ℕ) : n.primeFactorsList = [] ↔ n = 0
123123 · exact primeFactorsList_zero
124124 · exact primeFactorsList_one
125125
126+ theorem primeFactorsList_ne_nil (n : ℕ) : n.primeFactorsList ≠ [] ↔ 1 < n := by
127+ simp [primeFactorsList_eq_nil n, one_lt_iff_ne_zero_and_ne_one]
128+
126129open scoped List in
127130theorem eq_of_perm_primeFactorsList {a b : ℕ} (ha : a ≠ 0 ) (hb : b ≠ 0 )
128131 (h : a.primeFactorsList ~ b.primeFactorsList) : a = b := by
Original file line number Diff line number Diff line change @@ -889,6 +889,14 @@ lemma cardFactors_zero : Ω 0 = 0 := by simp
889889
890890@[simp] theorem cardFactors_one : Ω 1 = 0 := by simp [cardFactors_apply]
891891
892+ @[simp]
893+ theorem cardFactors_eq_zero_iff_eq_zero_or_one {n : ℕ} : Ω n = 0 ↔ n = 0 ∨ n = 1 := by
894+ rw [cardFactors_apply, List.length_eq_zero_iff, primeFactorsList_eq_nil]
895+
896+ @[simp]
897+ theorem cardFactors_pos_iff_one_lt {n : ℕ} : 0 < Ω n ↔ 1 < n := by
898+ rw [cardFactors_apply, List.length_pos_iff, primeFactorsList_ne_nil]
899+
892900@[simp]
893901theorem cardFactors_eq_one_iff_prime {n : ℕ} : Ω n = 1 ↔ n.Prime := by
894902 refine ⟨fun h => ?_, fun h => List.length_eq_one_iff.2 ⟨n, primeFactorsList_prime h⟩⟩
@@ -927,6 +935,10 @@ lemma cardFactors_pow {m k : ℕ} : Ω (m ^ k) = k * Ω m := by
927935theorem cardFactors_apply_prime_pow {p k : ℕ} (hp : p.Prime) : Ω (p ^ k) = k := by
928936 simp [cardFactors_pow, hp]
929937
938+ theorem cardFactors_eq_sum_factorization {n : ℕ} :
939+ Ω n = n.factorization.sum fun _ k => k := by
940+ simp [cardFactors_apply, ← List.sum_toFinset_count_eq_length, Finsupp.sum]
941+
930942/-- `ω n` is the number of distinct prime factors of `n`. -/
931943def cardDistinctFactors : ArithmeticFunction ℕ :=
932944 ⟨fun n => n.primeFactorsList.dedup.length, by simp⟩
You can’t perform that action at this time.
0 commit comments