Reindexing a divisor sum supported on multiples of
ProvedDivisorSums.sum_mul_substA divisor sum supported on multiples of can be reindexed by the cofactor.
Let vanish at every divisor of that is not a multiple of . Then
By hypothesis only the divisors with contribute on the left, and each such
is uniquely with ; moreover forces , so the substitution
is a bijection between and
. The guard if k * m \u2223 n on the right is what discards the values
of that do not arise this way, making the two sums equal term for term.
This reindexing is used constantly in sieve theory, where sums over squarefree supported on the sifting primes are repeatedly rewritten in terms of a fixed factor and a varying cofactor — in Selberg's sieve, for instance, when the quadratic form in the is diagonalised.
Formalization note. n.divisors excludes and is empty when , so no
degenerate case arises; the hypothesis is only imposed at divisors of , which is all the
sum sees.
import Mathlib
namespace DivisorSums
theorem sum_mul_subst (k n : ℕ) {f : ℕ → ℝ} (h : ∀ l, l ∣ n → ¬k ∣ l → f l = 0) :
∑ l ∈ n.divisors, f l = ∑ m ∈ n.divisors, if k * m ∣ n then f (k * m) else 0 := by sorry
end DivisorSums