Answers are grounded in this paper and cite their sources.
For an integer n ≥ 1 let S_n = (1/n) Σₖ₌₁ⁿ⁻¹ Rem(k² ÷ n) be the mean of the least residues of the squares modulo n, and let f(n) = Σⱼ₌₁⌊n/4⌋ ⌊√(jn)⌋ − (n² − 1)/12. A classical identity of Bunyakovsky says f(p) = 0 for primes p ≡ 1 (mod 4); Chamberland and Dilcher (arXiv:2510.04387) evaluated f(p) for p ≡ 3 (mod 4) by the class number of Q(√−p), treated n = 2p, 4p and prime powers, and stated five conjectures for composite n. We prove that for every n ≥ 1, S_n = (n − s(n))/2 − Σc | n, c ≡ 0, 3 (mod 4) h*(−c), where s(n) is the largest integer whose square divides n and h*(−c) = 2h(−c)/w(−c) is the weighted class number of primitive positive definite binary quadratic forms of discriminant −c. From this we obtain an explicit formula for f(n) for every n. Together they give proofs of all five conjectures (one of them after correcting a sign) and contain the evaluations proved by Chamberland and Dilcher as special cases. The conjectures have probably been proved before this note: Conjecture 7.2 in an AI-generated write-up on the Principia Math platform (MathDB problem 370786, September 2026), and, according to its listing, all five in a preprint of S. K. Jha posted on ResearchGate (October 2026), which we have not been able to consult. We make no claim of priority for them. The formula for S_n is not new either: it is equivalent to the case a = 1 of a proposition of Skoruppa and Zagier on cotangent-weighted Gauss sums (1988), and it was recorded in exactly this form in the OEIS entry A048153 in 2026. What the note offers is a self-contained account with complete proofs and a formal verification. We give two proofs of the formula for S_n. The first uses the Fourier series of the sawtooth function, Gauss sums and Dirichlet's class number formula, for an arbitrary modulus. The second counts the square roots of each residue modulo n, one prime power at a time, and uses class numbers only through Dirichlet's formula at fundamental discriminants and the conductor formula for orders. We also show, without class numbers, that |(n − s(n))/2 − S_n| ≤ n3/4 (1 + log n)3/2, which is enough for the limits in the fifth conjecture. The second proof, the formula for f(n), this bound and the derivation of all five conjectures are formalized in Lean 4 with Mathlib, with the class numbers in Bernoulli form (MeanResidue, all versions doi:10.5281/zenodo.24507181; version 1.0.2, doi:10.5281/zenodo.24514037, is listed in the Palomar registry, entry PALOMAR-2026-11-24-000022). The formal statements are checked against the proofs by Lean's comparator, and the proofs are replayed in Lean's kernel and in two independent kernels. The formulas for S_n and f(n) were also checked in exact arithmetic for every n ≤ 20000, and the other main statements numerically over finite ranges; the Python scripts and their outputs are in the numerics folder of the MeanResidue repository on GitHub, https://github.com/jkfarland-bot/MeanResidue/tree/main/numerics, and are archived with MeanResidue.
No takes yet. Share an insight, caveat, or question.
Joseph S. Farland (2026) studied this question.
Synapse has enriched 8 closely related papers on similar clinical questions. Consider them for comparative context: