Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§4.1 — if bbb is a primitive root of the prime mmm, every proper fraction k/mk/mk/m has period m−1m - 1m−1

Proved
CarryRNG.AWC.expansion_period_primitive_root

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

number-theoryp2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1periodic-expansion

Let b≥2b \ge 2b≥2 be a base and mmm a prime for which bbb is a primitive root, i.e. the multiplicative order of bbb modulo mmm is m−1m - 1m−1. Let 0<k<m0 < k < m0<k<m, and write d1,d2,…d_1, d_2, \dotsd1​,d2​,… for the base-bbb digits of k/mk/mk/m after the point. Then for every p>0p > 0p>0,

(dj+p=dj for all j≥1)  ⟺  (m−1)∣p,\bigl(d_{j+p} = d_j \text{ for all } j \ge 1\bigr) \iff (m - 1) \mid p ,(dj+p​=dj​ for all j≥1)⟺(m−1)∣p,

so the base-bbb expansion of every proper fraction k/mk/mk/m is strictly periodic with least period m−1m - 1m−1. This is why the paper seeks primes m=br±bs±1m = b^r \pm b^s \pm 1m=br±bs±1 having bbb as a primitive root: the generators built on them attain the longest possible period.

Formalization Note "Primitive root" is the hypothesis orderOf (b : ZMod m) = m - 1.

Preamble
import Mathlib
import Definitions.Def_CarryRNG_AWC_digit
Formal statement
namespace CarryRNG.AWC

theorem expansion_period_primitive_root (b m k : ℕ) (hb : 2 ≤ b) (hm : m.Prime)
    (hroot : orderOf (b : ZMod m) = m - 1) (hk0 : 0 < k) (hk : k < m) (p : ℕ) (hp : 0 < p) :
    (∀ j, 1 ≤ j → digit b m k (j + p) = digit b m k j) ↔ (m - 1) ∣ p := by sorry

end CarryRNG.AWC
Source
G. Marsaglia and A. Zaman, A new class of random number generators, Ann. Appl. Probab. 1 (1991), p. 467, Section 4.1 ("For our purposes, we want to choose primes m for which b is a primitive root. Then the period is m - 1 ...")
Human review
  • Endorsed by Shuze Chen · Oct 6, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 6, 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