Documentation

CslibFrontier.Foundations.Data.ZMod.Multiples

Multiples of a divisor in ZMod N #

For d ∣ N, the residues x : ZMod N whose canonical value x.val is divisible by d are exactly the subgroup generated by d, and there are N / d of them. The additive order of a residue y is N / gcd(N, y.val).

Main results #

theorem ZMod.mem_zmultiples_iff_dvd_val {N : ℕ} [NeZero N] {d : ℕ} (hd : d ∣ N) (x : ZMod N) :

For d ∣ N, the subgroup of ZMod N generated by d consists of the residues whose value is divisible by d.

theorem ZMod.card_filter_dvd_val {N : ℕ} [NeZero N] {d : ℕ} (hd : d ∣ N) :
{x : ZMod N | d ∣ x.val}.card = N / d

For d ∣ N, exactly N / d residues modulo N have value divisible by d.

theorem ZMod.filter_dvd_val_nonempty {N : ℕ} [NeZero N] (d : ℕ) :
{x : ZMod N | d ∣ x.val}.Nonempty

The residues with value divisible by d form a nonempty set: it contains 0.

theorem ZMod.addOrderOf_eq_div_gcd_val {N : ℕ} [NeZero N] (y : ZMod N) :
addOrderOf y = N / N.gcd y.val

The additive order of a residue y : ZMod N is N / gcd(N, y.val).