import Mathlib.Data.Nat.PrimeFinimport Mathlib.Tacticnamespace Erdos850theorem quadratic_family_excluded (x : ℕ) (hx : 0 < x) :(x + 2).primeFactors ≠ (x * (x + 2) + 2).primeFactors := byintro heqhave common {p : ℕ} (h : p ∈ (x + 2).primeFactors) : p = 2 := byhave h₁ := Nat.mem_primeFactors.mp hhave h₂ := Nat.mem_primeFactors.mp (heq ▸ h)have hmul : p ∣ x * (x + 2) := dvd_mul_of_dvd_right h₁.2.1 _have hd : p ∣ 2 := (Nat.dvd_add_right hmul).mp h₂.2.1exact (Nat.prime_two.eq_one_or_self_of_dvd p hd).resolve_left h₁.1.ne_onehave hp := Nat.minFac_prime (n := x + 2) (by omega)have heven : 2 ∣ x + 2 := byhave h := Nat.minFac_dvd (x + 2)rwa [common (Nat.mem_primeFactors.mpr ⟨hp, h, by omega⟩)] at hobtain ⟨t, ht⟩ : 2 ∣ x := by omegalet m := 2 * t * (t + 1) + 1have hm : 1 < m := by dsimp [m]; nlinarithhave hid : x * (x + 2) + 2 = 2 * m := by dsimp [m]; rw [ht]; ringhave hd : m.minFac ∣ 2 * m := dvd_mul_of_dvd_right (Nat.minFac_dvd m) _have hmem : m.minFac ∈ (x * (x + 2) + 2).primeFactors := byrw [hid]exact Nat.mem_primeFactors.mpr ⟨Nat.minFac_prime (by omega), hd, by omega⟩have htwo := common (heq.symm ▸ hmem)have hd' := Nat.minFac_dvd mrw [htwo] at hd'dsimp [m] at hd'rw [show 2*t*(t+1) = 2*(t*(t+1)) by ring] at hd'omega#print axioms quadratic_family_excludedend Erdos850