Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

First kkk digits equal nnn with probability log⁡10(1+1/n)\log_{10}(1+1/n)log10​(1+1/n)

Proved
BenfordLaw.leadingDigits_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). Let k≥1k\ge1k≥1 and let nnn be a kkk-digit integer, 10k−1≤n<10k10^{k-1}\le n<10^k10k−1≤n<10k. Then the probability that XXX starts with the string of digits nnn (leading zeros discarded) is

P(D10(k)(X)=n)=log⁡10(n+1)−log⁡10(n)=log⁡10 ⁣(1+1n).\mathbb P\big(D^{(k)}_{10}(X) = n\big) = \log_{10}(n+1)-\log_{10}(n) = \log_{10}\!\left(1+\frac1n\right).P(D10(k)​(X)=n)=log10​(n+1)−log10​(n)=log10​(1+n1​).

For example, the probability of starting with the digits 3,1,43,1,43,1,4 is log⁡10(1+1/314)≈0.00138\log_{10}(1+1/314)\approx 0.00138log10​(1+1/314)≈0.00138.

Preamble
import Mathlib
import Definitions.Def_BenfordLaw_Defs
Formal statement
namespace BenfordLaw

theorem leadingDigits_prob_of_uniform_log_mantissa {Ω : Type*} [MeasurableSpace Ω]
    (P : MeasureTheory.Measure Ω) (X : Ω → ℝ) (hX : HasUniformLogMantissa 10 P X)
    (k n : ℕ) (hk : 1 ≤ k) (hn1 : 10 ^ (k - 1) ≤ n) (hn2 : n < 10 ^ k) :
    (P {ω | leadingDigits 10 k (X ω) = n}).toReal = Real.logb 10 (1 + 1 / (n : ℝ)) := 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 log⁡10(n+1)−log⁡10(n)=log⁡10(1+1/n)\log_{10}(n+1)-\log_{10}(n)=\log_{10}(1+1/n)log10​(n+1)−log10​(n)=log10​(1+1/n), ref. Hill 1995, https://doi.org/10.1080/00029890.1995.11990578).
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 X:Ω→RX:\Omega\to\mathbb RX:Ω→R satisfy HasUniformLogMantissa(10,P,X)\mathrm{HasUniformLogMantissa}(10,P,X)HasUniformLogMantissa(10,P,X) (measurable, positive a.e., {log⁡10X}\{\log_{10}X\}{log10​X} has law Lebesgue on [0,1)[0,1)[0,1)). For all naturals k,nk,nk,n with k≥1k\ge1k≥1, 10k−1≤n10^{k-1}\le n10k−1≤n (natural subtraction) and n<10kn<10^kn<10k:

P{ω:⌊10{log⁡10X(ω)}+(k−1)⌋=n} (as a real)=log⁡10(1+1/n).P\{\omega : \lfloor 10^{\{\log_{10}X(\omega)\}+(k-1)}\rfloor = n\} \ (\text{as a real}) = \log_{10}(1+1/n).P{ω:⌊10{log10​X(ω)}+(k−1)⌋=n} (as a real)=log10​(1+1/n).
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