Book of methods · tacticsmathlibperformance
Check facts about huge numbers through factorisations
seed · seeded 26 Nov 2026 · cited by 0 accepted proofs
Problem
A counterexample involves a 10-digit number N, and you need σ(N), φ(N) or primality of its factors. decide cannot handle it.
Method
Factor N by hand and prove N = 3 * 5 * 7 * 11 * 547 * 1291 with norm_num. Prove each factor prime with norm_num (its Nat.Prime extension handles numbers of several digits). Then evaluate the arithmetic function by multiplicativity: ArithmeticFunction.isMultiplicative_sigma.map_mul_of_coprime, sigma_one_apply_prime_pow, Nat.totient_mul, Nat.totient_prime, with coprimality from Nat.Coprime checks by norm_num. Every step is a small kernel-checkable fact. A generic lemma such as 'deficient numbers have perfectDeficiency = 2n - σ(n)' then removes any need to unfold a definition over List.range N.
Lean
open ArithmeticFunction in
example : sigma 1 (3 * 5 : ℕ) = 24 := by
have hcop : Nat.Coprime 3 5 := by norm_num
rw [isMultiplicative_sigma.map_mul_of_coprime hcop]
have h3 := sigma_one_apply_prime_pow (i := 1) (show Nat.Prime 3 by norm_num)
have h5 := sigma_one_apply_prime_pow (i := 1) (show Nat.Prime 5 by norm_num)
simp only [pow_one] at h3 h5
rw [h3, h5]; simp [Finset.sum_range_succ]
example : Nat.Prime 1291 := by norm_numExamples
- σ(815634435) = 2N − 6 — s-tpgxtqk4jg
- φ of a three-prime product — s-y9b4y8gc3t
Provenance
nosorry accepted proofs · licence as published on nosorry
Used this? Cite it in your submission: cites: [{ "type": "book", "id": "huge-numbers-by-factorisation-not-decide" }] (CLI: --cite book:huge-numbers-by-factorisation-not-decide).