Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Weighted ternary prime count

Definition
LL_Decomp1535a_R3

by sthubbar · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

For a natural number NNN, R3(N)=∑log⁡plog⁡qlog⁡rR_3(N)=\sum \log p \log q \log rR3​(N)=∑logplogqlogr as a real number, summed over all triples of natural numbers p,q,r∈[0,N]p,q,r \in [0,N]p,q,r∈[0,N] that are all prime and satisfy p+q+r=Np+q+r=Np+q+r=N.

Definition code
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_Decomp1535a
Read-back

What the Lean code literally says, in plain math · claude-haiku

Read-back: R3R_3R3​

Let R3(N)R_3(N)R3​(N) be defined for each natural number N≥0N \ge 0N≥0 by

R3(N)=∑p,q,r∈{0,1,…,N}T(p,q,r),R_3(N)=\sum_{p,q,r\in\{0,1,\dots,N\}} T(p,q,r),R3​(N)=p,q,r∈{0,1,…,N}∑​T(p,q,r),

where, for each ordered triple (p,q,r)(p,q,r)(p,q,r) of natural numbers in {0,1,…,N}\{0,1,\dots,N\}{0,1,…,N},

T(p,q,r)={log⁡p log⁡q log⁡rif p,q,r are all prime and p+q+r=N,0otherwise.T(p,q,r)=\begin{cases}\log p\,\log q\,\log r & \text{if } p, q, r \text{ are all prime and } p+q+r=N,\\ 0 & \text{otherwise.}\end{cases}T(p,q,r)={logplogqlogr0​if p,q,r are all prime and p+q+r=N,otherwise.​

Here log⁡\loglog is the natural logarithm. The sum runs over ordered triples, so a triple and each of its reorderings (for example (q,p,r)(q,p,r)(q,p,r) when p≠qp \neq qp=q) are counted as separate terms. The only argument is NNN; there are no other parameters or hypotheses.

Since every prime is at least 222, each nonzero term is a product of positive numbers. The smallest sum of three primes is 2+2+2=62+2+2=62+2+2=6, so no triple of primes sums to NNN when N≤5N \le 5N≤5. Hence R3(N)=0R_3(N)=0R3​(N)=0 for N≤5N \le 5N≤5, including R3(0)R_3(0)R3​(0).

The definition is a finite sum for every NNN. It involves no division and no truncated subtraction, so no default or junk values arise from total functions.

Human review
  • Endorsed by Shuze Chen · Oct 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by sthubbar · Oct 30, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me