The mean e-th power residue modulo any n, formalized in Lean
For integers e, n ≥ 1 let S_e(n) be the mean of the least residues of the e-th powers modulo n, and let s_e(n) be the number of k modulo n with n | k^e. We prove that S_e(n) = (n − s_e(n))/2 + Σ_ψ B_{1,ψ} W_n(ψ), where ψ runs over the odd primitive Dirichlet characters with ψ^e = 1 whose conductor divides n, B_{1,ψ} is the first generalized Bernoulli number, and W_n(ψ) is an explicit product of local weights built from the values ψ(p) at the primes p | n. For e = 2 this is the classical formula for the mean quadratic residue through Hurwitz class numbers (the case a = 1 of a proposition of Skoruppa and Zagier). For odd e the sum is empty and S_e(n) = (n − s_e(n))/2. For prime moduli the evaluation is classical. We found no statement for e ≥ 3 and composite n in the literature, and make no claim of priority. The proof is elementary: it counts e-th roots one prime power at a time and uses only the orthogonality of characters. The note gives worked values for fourth powers. It is the companion note of the Lean 4 / Mathlib formalization MeanPowerResidue (doi:10.5281/zenodo.24616951). That formalization has no hypotheses and quotes nothing, and Lean's comparator checks it under three independent kernels.
Authors
- Joseph S. Farland (ORCID: https://orcid.org/0009-0007-6809-804X)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-28
- DOI
- https://doi.org/10.5281/zenodo.24617087
- Primary Topic
- Analytic Number Theory Research
- Type
- preprint