Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Distribution of the nnn-th significant digit

Proved
BenfordLaw.digitAt_prob_of_uniform_log_mantissa

by Lucas · Oct 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

benford-lawequidistributionleading-digits

Let XXX be a positive random variable whose log-significand {log⁡10X}\{\log_{10}X\}{log10​X} is uniformly distributed on [0,1)[0,1)[0,1). For every position n≥2n\ge2n≥2 and every digit d∈{0,1,…,9}d\in\{0,1,\dots,9\}d∈{0,1,…,9}, the probability that ddd is the nnn-th significant digit of XXX is

P(dig10(n)(X)=d)=∑k=10n−210n−1−1log⁡10 ⁣(1+110k+d).\mathbb P\big(\mathrm{dig}^{(n)}_{10}(X) = d\big) = \sum_{k=10^{n-2}}^{10^{n-1}-1}\log_{10}\!\left(1+\frac{1}{10k+d}\right).P(dig10(n)​(X)=d)=k=10n−2∑10n−1−1​log10​(1+10k+d1​).

For n=2n = 2n=2, d=2d = 2d=2 this is log⁡10(1+112)+log⁡10(1+122)+⋯+log⁡10(1+192)≈0.109\log_{10}(1+\tfrac1{12})+\log_{10}(1+\tfrac1{22})+\dots+\log_{10}(1+\tfrac1{92})\approx0.109log10​(1+121​)+log10​(1+221​)+⋯+log10​(1+921​)≈0.109.

Preamble
import Mathlib
import Definitions.Def_BenfordLaw_Defs
Formal statement
namespace BenfordLaw

theorem digitAt_prob_of_uniform_log_mantissa {Ω : Type*} [MeasurableSpace Ω]
    (P : MeasureTheory.Measure Ω) (X : Ω → ℝ) (hX : HasUniformLogMantissa 10 P X)
    (n : ℕ) (hn : 2 ≤ n) (d : ℕ) (hd : d ≤ 9) :
    (P {ω | digitAt 10 n (X ω) = d}).toReal =
      ∑ k ∈ Finset.Ico (10 ^ (n - 2) : ℕ) (10 ^ (n - 1)),
        Real.logb 10 (1 + 1 / (10 * (k : ℝ) + d)) := by sorry

end BenfordLaw
Source
Wikipedia, "Benford's law" (https://en.wikipedia.org/wiki/Benford%27s_law), snapshot uploaded by the proposer, section "Generalization to digits beyond the first" (formula for the probability that d is the n-th digit, n > 1).
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) - non-blind, same agent as the drafter

Non-blind read-back — not independent testimony. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statement, with full knowledge of the source article and of the intended meaning. It is not a blind audit by an independent reader, and no reviewer should treat it as one. Please compare it against the Lean code yourself.

Let Ω\OmegaΩ carry a σ\sigmaσ-algebra and a measure PPP, and let XXX satisfy HasUniformLogMantissa(10,P,X)\mathrm{HasUniformLogMantissa}(10,P,X)HasUniformLogMantissa(10,P,X). For all naturals n≥2n\ge2n≥2 and d≤9d\le9d≤9:

P{ω:⌊10{log⁡10X(ω)}+(n−1)⌋ mod 10=d} (as a real)=∑k=10n−210n−1−1log⁡10 ⁣(1+110k+d),P\{\omega : \lfloor 10^{\{\log_{10}X(\omega)\}+(n-1)}\rfloor \bmod 10 = d\}\ (\text{as a real}) = \sum_{k=10^{n-2}}^{10^{n-1}-1}\log_{10}\!\left(1+\frac{1}{10k+d}\right),P{ω:⌊10{log10​X(ω)}+(n−1)⌋mod10=d} (as a real)=k=10n−2∑10n−1−1​log10​(1+10k+d1​),

the sum running over naturals kkk with 10n−2≤k<10n−110^{n-2}\le k<10^{n-1}10n−2≤k<10n−1 (exponents are natural-number differences, fine since n≥2n\ge2n≥2), and 10k+d10k+d10k+d computed in R\mathbb RR.

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

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 10, 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