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.Nat.Choose.Factorization

24 declarations. Mathlib docs · Source

Factorization of Binomial Coefficients

This file contains a few results on the multiplicity of prime factors within certain size bounds in binomial coefficients. These include:

  • Nat.factorization_choose_le_log: a logarithmic upper bound on the multiplicity of a prime in a binomial coefficient.
  • Nat.factorization_choose_le_one: Primes above sqrt n appear at most once in the factorization of n choose k.
  • Nat.factorization_centralBinom_of_two_mul_self_lt_three_mul: Primes from 2 * n / 3 to n do not appear in the factorization of the nth central binomial coefficient.
  • Nat.factorization_choose_eq_zero_of_lt: Primes greater than n do not appear in the factorization of n choose k.

These results appear in the [Erdős proof of Bertrand's postulate][aigner1999proofs].

theorem Nat.factorization_factorial E1 #

∀ {p : ℕ}, Nat.Prime p → ∀ {n b : ℕ}, Nat.log p n < b → n.factorial.factorization p = ∑ i ∈ Finset.Ico 1 b, n / p ^ i

Legendre's Theorem

The multiplicity of a prime in n! is the sum of the quotients n / p ^ i. This sum is expressed over the finset Ico 1 b where b is any bound greater than log p n.

theorem Nat.sub_one_mul_factorization_factorial E1 #

∀ {n p : ℕ}, Nat.Prime p → (p - 1) * n.factorial.factorization p = n - (p.digits n).sum

For a prime number p, taking (p - 1) times the factorization of p in n! equals n minus the sum of base p digits of n.

theorem Nat.factorization_factorial_mul_succ E1 #

∀ {n p : ℕ},
  Nat.Prime p →
    (p * (n + 1)).factorial.factorization p = (p * n).factorial.factorization p + (n + 1).factorization p + 1

The factorization of p in (p * (n + 1))! is one more than the sum of the factorizations of p in (p * n)! and n + 1.

theorem Nat.factorization_factorial_mul E1 #

∀ {n p : ℕ}, Nat.Prime p → (p * n).factorial.factorization p = n.factorial.factorization p + n

The factorization of p in (p * n)! is n more than that of n!.

theorem Nat.factorization_factorial_le_div_pred E1 #

∀ {p : ℕ}, Nat.Prime p → ∀ (n : ℕ), n.factorial.factorization p ≤ n / (p - 1)

theorem Nat.multiplicity_choose_aux E0 #

∀ {p n b k : ℕ},
  Nat.Prime p →
    k ≤ n →
      ∑ i ∈ Finset.Ico 1 b, n / p ^ i =
        ∑ i ∈ Finset.Ico 1 b, k / p ^ i + ∑ i ∈ Finset.Ico 1 b, (n - k) / p ^ i +
          {i ∈ Finset.Ico 1 b | p ^ i ≤ k % p ^ i + (n - k) % p ^ i}.card

theorem Nat.factorization_choose' E1 #

∀ {p n k b : ℕ},
  Nat.Prime p →
    Nat.log p (n + k) < b →
      ((n + k).choose k).factorization p = {i ∈ Finset.Ico 1 b | p ^ i ≤ k % p ^ i + n % p ^ i}.card

The factorization of p in choose (n + k) k is the number of carries when k and n are added in base p. The set is expressed by filtering Ico 1 b where b is any bound greater than log p (n + k).

theorem Nat.factorization_choose E1 #

∀ {p n k b : ℕ},
  Nat.Prime p →
    k ≤ n →
      Nat.log p n < b → (n.choose k).factorization p = {i ∈ Finset.Ico 1 b | p ^ i ≤ k % p ^ i + (n - k) % p ^ i}.card

The factorization of p in choose n k is the number of carries when k and n - k are added in base p. The set is expressed by filtering Ico 1 b where b is any bound greater than log p n.

theorem Nat.factorization_le_factorization_of_dvd_right E1 #

∀ {a b c : ℕ}, b ∣ c → b ≠ 0 → c ≠ 0 → b.factorization a ≤ c.factorization a

Modified version of emultiplicity_le_emultiplicity_of_dvd_right but for factorization.

theorem Nat.factorization_le_factorization_choose_add E1 #

∀ {p n k : ℕ}, k ≤ n → k ≠ 0 → n.factorization p ≤ (n.choose k).factorization p + k.factorization p

A lower bound on the factorization of p in choose n k.

theorem Nat.factorization_choose_prime_pow_add_factorization E1 #

∀ {p n k : ℕ}, Nat.Prime p → k ≤ p ^ n → k ≠ 0 → ((p ^ n).choose k).factorization p + k.factorization p = n

theorem Nat.factorization_choose_prime_pow E1 #

∀ {p n k : ℕ}, Nat.Prime p → k ≤ p ^ n → k ≠ 0 → ((p ^ n).choose k).factorization p = n - k.factorization p

theorem Nat.factorization_add_factorization_choose_le_log E1 #

∀ {p n k : ℕ}, k ≤ n → k.factorization p + (n.choose k).factorization p ≤ Nat.log p n

theorem Nat.factorization_choose_le_log E1 #

∀ {p n k : ℕ}, (n.choose k).factorization p ≤ Nat.log p n

A logarithmic upper bound on the multiplicity of a prime in a binomial coefficient.

theorem Nat.pow_factorization_choose_le E1 #

∀ {p n k : ℕ}, 0 < n → p ^ (n.choose k).factorization p ≤ n

A pow form of Nat.factorization_choose_le

theorem Nat.factorization_choose_le_one E1 #

∀ {p n k : ℕ}, n < p ^ 2 → (n.choose k).factorization p ≤ 1

Primes greater than about sqrt n appear only to multiplicity 0 or 1 in the binomial coefficient.

theorem Nat.factorization_choose_of_lt_three_mul E1 #

∀ {p n k : ℕ}, p ≠ 2 → p ≤ k → p ≤ n - k → n < 3 * p → (n.choose k).factorization p = 0

theorem Nat.factorization_centralBinom_of_two_mul_self_lt_three_mul E1 #

∀ {p n : ℕ}, 2 < n → p ≤ n → 2 * n < 3 * p → n.centralBinom.factorization p = 0

Primes greater than about 2 * n / 3 and less than n do not appear in the factorization of centralBinom n.

theorem Nat.factorization_factorial_eq_zero_of_lt E1 #

∀ {p n : ℕ}, n < p → n.factorial.factorization p = 0

theorem Nat.factorization_choose_eq_zero_of_lt E1 #

∀ {p n k : ℕ}, n < p → (n.choose k).factorization p = 0

theorem Nat.factorization_centralBinom_eq_zero_of_two_mul_lt E1 #

∀ {p n : ℕ}, 2 * n < p → n.centralBinom.factorization p = 0

If a prime p has positive multiplicity in the nth central binomial coefficient, p is no more than 2 * n

theorem Nat.le_two_mul_of_factorization_centralBinom_pos E1 #

∀ {p n : ℕ}, 0 < n.centralBinom.factorization p → p ≤ 2 * n

Contrapositive form of Nat.factorization_centralBinom_eq_zero_of_two_mul_lt

theorem Nat.prod_pow_factorization_choose E1 #

∀ (n k : ℕ), k ≤ n → ∏ p ∈ Finset.range (n + 1), p ^ (n.choose k).factorization p = n.choose k

A binomial coefficient is the product of its prime factors, which are at most n.

theorem Nat.prod_pow_factorization_centralBinom E1 #

∀ (n : ℕ), ∏ p ∈ Finset.range (2 * n + 1), p ^ n.centralBinom.factorization p = n.centralBinom

The nth central binomial coefficient is the product of its prime factors, which are at most 2n.