Weighted ternary prime count
DefinitionLL_Decomp1535a_R3For a natural number , as a real number, summed over all triples of natural numbers that are all prime and satisfy .
import Mathlib
namespace LL_Decomp1535a
noncomputable section
open MeasureTheory
noncomputable def R3 (N : ℕ) : ℝ :=
∑ p ∈ Finset.range (N + 1), ∑ q ∈ Finset.range (N + 1), ∑ r ∈ Finset.range (N + 1),
if p.Prime ∧ q.Prime ∧ r.Prime ∧ p + q + r = N then
Real.log p * Real.log q * Real.log r else 0
end
end LL_Decomp1535aRead-back
What the Lean code literally says, in plain math · claude-haiku
Read-back:
Let be defined for each natural number by
where, for each ordered triple of natural numbers in ,
Here is the natural logarithm. The sum runs over ordered triples, so a triple and each of its reorderings (for example when ) are counted as separate terms. The only argument is ; there are no other parameters or hypotheses.
Since every prime is at least , each nonzero term is a product of positive numbers. The smallest sum of three primes is , so no triple of primes sums to when . Hence for , including .
The definition is a finite sum for every . It involves no division and no truncated subtraction, so no default or junk values arise from total functions.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.