The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V02. Numbers

Mathlib.Data.ZMod.Factorial

1 declarations. Mathlib docs · Source

Facts about factorials in ZMod

We collect facts about factorials in context of modular arithmetic.

Main statements

  • ZMod.cast_descFactorial: For natural numbers n and p, where n is less than or equal to p the descending factorial of (p - 1) taken n times modulo p equals (-1) ^ n * n!.

See also

For the prime case and involving factorial rather than descFactorial, see Wilson's theorem:

  • Nat.prime_iff_fac_equiv_neg_one

theorem ZMod.cast_descFactorial E3 #

∀ {n p : ℕ}, n ≤ p → ↑((p - 1).descFactorial n) = (-1) ^ n * ↑n.factorial