Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

§5, p. 1498 — the order of x mod n is the lcm of its orders mod the prime powers p_i^{α_i}

Proved
ShorAlgorithms.Reduction.orderOf_eq_lcm

by mikedeng1 · Sep 29, 2026 · Mathlib 0df444a (Lean v4.33.1)

chinese-remainder-theoremnumber-theoryorder-findingp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let n=∏i=1kpiαin = \prod_{i=1}^k p_i^{\alpha_i}n=∏i=1k​piαi​​ be the prime factorization of n≥1n \ge 1n≥1, let xxx be a unit modulo nnn with order rrr, and let rir_iri​ be the order of x mod piαix \bmod p_i^{\alpha_i}xmodpiαi​​. Then

r=lcm⁡(r1,…,rk).r = \operatorname{lcm}(r_1, \dots, r_k).r=lcm(r1​,…,rk​).

This reduces questions about the order modulo nnn to the orders modulo the prime powers, where the unit groups are cyclic when pip_ipi​ is odd.

Formalization Note The rir_iri​ are localOrder n u p for p ∈ n.primeFactors, and the lcm is Finset.lcm over n.primeFactors (equal to 111 when n=1n = 1n=1). The hypothesis 0<n0 < n0<n replaces Shor's standing "nnn odd"; oddness is not needed here, while n=0n = 0n=0 must be excluded because ZMod 0 is Z\mathbb{Z}Z.

Preamble
import Mathlib
import Definitions.Def_ShorAlgorithms_Reduction_localOrder
Formal statement
namespace ShorAlgorithms.Reduction

/-- Shor (1997), §5, p. 1498: with `n = ∏ p_i^{α_i}` and `r_i` the order of `x (mod p_i^{α_i})`,
the order `r` of `x (mod n)` is the least common multiple of all the `r_i`. -/
theorem orderOf_eq_lcm (n : ℕ) (hn : 0 < n) (u : (ZMod n)ˣ) :
    orderOf u = n.primeFactors.lcm (localOrder n u) := by sorry

end ShorAlgorithms.Reduction
Source
Shor, Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer, SIAM J. Comput. 26(5) (1997), p. 1498, §5, "Suppose that n = ∏_{i=1}^k p_i^{α_i} is the prime factorization of n. Let r_i be the order of x (mod p_i^{α_i}). Then r is the least common multiple of all the r_i."
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me