Divisibility by prime powers through binomial coefficients #
For a prime p, the base-p digits of c are read off modulo p by binomial coefficients:
C(c, p ^ i) ≡ ⌊c / p ^ i⌋ (mod p) by Lucas's theorem. Hence p ^ e ∣ c exactly when
p ∣ C(c, p ^ i) for every i < e (Nat.pow_dvd_iff_forall_dvd_choose), and c is not divisible
by a positive m exactly when p ∤ C(c, p ^ i) for some prime p and some i with
p ^ (i + 1) ∣ m (Nat.mod_ne_zero_iff_exists_not_dvd_choose). This is the reduction of a
MOD_m gate to MOD_p tests of polynomials of degree below m [BeigelTarui1994, Lemma 2.1 and
Fact 2.2].
Main results #
Nat.pow_dvd_iff_forall_dvd_choose:p ^ e ∣ c ↔ ∀ i < e, p ∣ C(c, p ^ i).Nat.mod_ne_zero_iff_exists_not_dvd_choose:c % m ≠ 0through prime-power binomial coefficients.
References #
Prime-power divisibility from binomial coefficients. For a prime p, p ^ e ∣ c exactly
when p ∣ C(c, p ^ i) for every i < e: the binomial coefficient C(c, p ^ i) is the i-th
base-p digit of c modulo p [BeigelTarui1994, Fact 2.2].
Non-divisibility through prime-power binomial coefficients. For m > 0, c is not
divisible by m exactly when some prime p and some i with p ^ (i + 1) ∣ m have
p ∤ C(c, p ^ i). Such p and i satisfy p ≤ m and i < m.