A bound for a weighted divisor sum
ProvedDivisorSums.sum_sqrt_gcd_div_le_log_two_mulA harmonic sum weighted by .
For every ,
where is the number of divisors of .
Without the weight the sum is the harmonic sum . The weight can be as large as (at ), so a trivial bound would lose a factor of ; the theorem says the true cost is only a factor , which is .
The mechanism is to sort by : for each divisor the terms with contribute at most , and summing over the divisors gives the stated bound. The constant and the shift to come from bounding the inner harmonic sums dyadically, which also keeps the estimate valid at .
Weighted sums of this shape occur when estimating Kloosterman-type sums and in sieve manipulations, where a gcd weight appears after grouping residues by their common factor with the modulus.
Formalization note. n.divisors.card is ; the sum runs over and all
quantities are real.
import Mathlib
namespace DivisorSums
theorem sum_sqrt_gcd_div_le_log_two_mul (n : ℕ) (hn : n ≠ 0) :
∑ s ∈ Finset.Icc 1 n, Real.sqrt (Nat.gcd n s : ℝ) / s
≤ (Real.log 2)⁻¹ * (n.divisors.card : ℝ) * Real.log (2 * n) := by sorry
end DivisorSums