Mean quadratic residues, floor sums of square roots, and class numbers: the conjectures of Chamberland and Dilcher

For an integer n ≥ 1 let S_n = (1/n) Σ_{k=1}^{n−1} Rem(k² ÷ n) be the mean of the least residues of the squares modulo n, and let f(n) = Σ_{j=1}^{⌊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| ≤ n^{3/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.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-24
DOI
https://doi.org/10.5281/zenodo.24508994
Primary Topic
Analytic Number Theory Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Mean quadratic residues, floor sums of square roots, and class numbers: the conjectures of Chamberland and Dilcher

Joseph S. Farland
Zenodo (CERN European Organization for Nuclear Research)
Analytic Number Theory Research
preprint

Mean quadratic residues, floor sums of square roots, and class numbers: the conjectures of Chamberland and Dilcher

Joseph S. Farland
preprint en

Abstract

For an integer n ≥ 1 let S_n = (1/n) Σ_{k=1}^{n−1} Rem(k² ÷ n) be the mean of the least residues of the squares modulo n, and let f(n) = Σ_{j=1}^{⌊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| ≤ n^{3/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.

Zenodo (CERN European Organization for Nuclear Research)
Analytic Number Theory Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon