/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import Mathlib.Analysis.SpecificLimits.Normed public import Mathlib.NumberTheory.ArithmeticFunction.Misc public import Mathlib.Topology.Algebra.InfiniteSum.Real public import Mathlib.Tactic.FieldSimp public import Mathlib.Tactic.Linarith public import Mathlib.Tactic.NormNum public import Mathlib.Tactic.Positivity

Prime-divisor generating series

The generating series of the number of distinct prime divisors, evaluated at one half, can be rearranged into a sum over primes using absolute summability.

@[expose] public sectionopen scoped ArithmeticFunction.omeganamespace ArithmeticFunction

The number of distinct prime factors is the cardinality of Nat.primeFactors.

All goals completed! 🐙

The term primeDivTerm m p is (1 / 2) ^ m when p is a prime dividing the positive integer m, and 0 otherwise.

private noncomputable def primeDivTerm (m p : ℕ) : ℝ := if p.Prime ∧ p ∣ m ∧ m ≠ 0 then (1 / 2 : ℝ) ^ m else 0

Summing primeDivTerm m p over the primes p gives ω m / 2 ^ m.

m:ℕhm:m ≠ 0hsupp:Function.support (primeDivTerm m) ⊆ ↑m.primeFactorsthis:∀ p ∈ m.primeFactors, primeDivTerm m p = (1 / 2) ^ m⊢ ↑m.primeFactors.card * (1 / 2) ^ m = ↑m.primeFactors.card / 2 ^ m All goals completed! 🐙

Summing primeDivTerm m p over m for a prime p gives 1 / (2 ^ p - 1).

p:ℕhp:Nat.Prime phinj:Function.Injective fun k ↦ p * (k + 1)hsupp:(Function.support fun m ↦ primeDivTerm m p) ⊆ Set.range fun k ↦ p * (k + 1)hr0:0 ≤ (1 / 2) ^ phr1:(1 / 2) ^ p < 1this✝:∀ (k : ℕ), primeDivTerm (p * (k + 1)) p = (1 / 2) ^ p * ((1 / 2) ^ p) ^ kh2:1 < 2 ^ pthis:2 ^ p - 1 ≠ 0h3:2 ^ p ≠ 0⊢ (2 ^ p)⁻¹ * (1 - (2 ^ p)⁻¹)⁻¹ = 1 / (2 ^ p - 1) All goals completed! 🐙

The double series defining primeDivTerm is summable.

hnn:0 ≤ fun x ↦ primeDivTerm x.1 x.2hs:Summable fun m ↦ ↑m ^ 1 * (1 / 2) ^ mm:ℕthis:↑(ω m) ≤ ↑m⊢ ↑(ω m) * (2 ^ m)⁻¹ ≤ ↑m * (2 ^ m)⁻¹ exact mul_le_mul_of_nonneg_right this (hnn:0 ≤ fun x ↦ primeDivTerm x.1 x.2hs:Summable fun m ↦ ↑m ^ 1 * (1 / 2) ^ mm:ℕthis:↑(ω m) ≤ ↑m⊢ 0 ≤ (2 ^ m)⁻¹ All goals completed! 🐙)

The generating series for the number of distinct prime divisors converges at one half.

lemma summable_cardDistinctFactors_div_two_pow : Summable (fun n : ℕ => (ω n : ℝ) / 2 ^ n) := summable_primeDivTerm.prod.congr (fun n => tsum_primeDivTerm_right n)

The generating series for the number of distinct prime divisors, evaluated at one half, is a sum over primes of reciprocals of Mersenne numbers.

All goals completed! 🐙end ArithmeticFunction