Smooth numbers #
For s : Finset ℕ we define the set Nat.factoredNumbers s of "s-factored numbers"
consisting of the positive natural numbers all of whose prime factors are in s, and
we provide some API for this.
We then define the set Nat.smoothNumbers n consisting of the positive natural numbers all of
whose prime factors are strictly less than n. This is the special case s = Finset.range n
of the set of s-factored numbers.
We also define the finite set Nat.primesBelow n to be the set of prime numbers less than n.
The main definition Nat.equivProdNatSmoothNumbers establishes the bijection between
ℕ × (smoothNumbers p) and smoothNumbers (p+1) given by sending (e, n) to p^e * n.
Here p is a prime number. It is obtained from the more general bijection between
ℕ × (factoredNumbers s) and factoredNumbers (s ∪ {p}); see Nat.equivProdNatFactoredNumbers.
Additionally, we define Nat.smoothNumbersUpTo N n as the Finset of n-smooth numbers
up to and including N, and similarly Nat.roughNumbersUpTo for its complement in {1, ..., N},
and we provide some API, in particular bounds for their cardinalities; see
Nat.smoothNumbersUpTo_card_le and Nat.roughNumbersUpTo_card_le.
primesBelow n is the set of primes less than n as a Finset.
Equations
- n.primesBelow = {p ∈ Finset.range n | Nat.Prime p}
Instances For
Alias of Nat.notMem_primesBelow.
s-factored numbers #
factoredNumbers s, for a finite set s of natural numbers, is the set of positive natural
numbers all of whose prime factors are in s.
Instances For
Membership in Nat.factoredNumbers n is decidable.
Equations
- Nat.instDecidablePredMemSetFactoredNumbers s = inferInstanceAs (DecidablePred fun (x : ℕ) => x ∈ {m : ℕ | m ≠ 0 ∧ ∀ p ∈ m.primeFactorsList, p ∈ s})
A number that divides an s-factored number is itself s-factored.
The Finset of prime factors of an s-factored number is contained in s.
If m ≠ 0 and the Finset of prime factors of m is contained in s, then m
is s-factored.
m is s-factored if and only if m ≠ 0 and its Finset of prime factors
is contained in s.
The product of two s-factored numbers is again s-factored.
The product of the prime factors of n that are in s is an s-factored number.
The sets of s-factored and of s ∪ {N}-factored numbers are the same when N is not prime.
See Nat.equivProdNatFactoredNumbers for when N is prime.
If p is a prime and n is s-factored, then every product p^e * n
is s ∪ {p}-factored.
If p ∉ s is a prime and n is s-factored, then p and n are coprime.
If f : ℕ → F is multiplicative on coprime arguments, p ∉ s is a prime and m
is s-factored, then f (p^e * m) = f (p^e) * f m.
We establish the bijection from ℕ × factoredNumbers s to factoredNumbers (s ∪ {p})
given by (e, n) ↦ p^e * n when p ∉ s is a prime. See Nat.factoredNumbers_insert for
when p is not prime.
Equations
- One or more equations did not get rendered due to their size.
Instances For
n-smooth numbers #
smoothNumbers n is the set of n-smooth positive natural numbers, i.e., the
positive natural numbers all of whose prime factors are less than n.
Instances For
The n-smooth numbers agree with the Finset.range n-factored numbers.
The n-smooth numbers agree with the primesBelow n-factored numbers.
Alias of Nat.smoothNumbers_eq_factoredNumbers_primesBelow.
The n-smooth numbers agree with the primesBelow n-factored numbers.
Membership in Nat.smoothNumbers n is decidable.
Equations
- n.instDecidablePredMemSetSmoothNumbers = inferInstanceAs (DecidablePred fun (x : ℕ) => x ∈ {m : ℕ | m ≠ 0 ∧ ∀ p ∈ m.primeFactorsList, p < n})
A number that divides an n-smooth number is itself n-smooth.
m is n-smooth if and only if all prime divisors of m are less than n.
The Finset of prime factors of an n-smooth number is contained in the Finset
of primes below n.
m is an n-smooth number if the Finset of its prime factors consists of numbers < n.
m is an n-smooth number if and only if m ≠ 0 and the Finset of its prime factors
is contained in the Finset of primes below n
Zero is never a smooth number
The product of two n-smooth numbers is an n-smooth number.
The product of the prime factors of n that are less than N is an N-smooth number.
The sets of N-smooth and of (N+1)-smooth numbers are the same when N is not prime.
See Nat.equivProdNatSmoothNumbers for when N is prime.
All m, 0 < m < n are n-smooth numbers
If p is positive and n is p-smooth, then every product p^e * n is (p+1)-smooth.
If p is a prime and n is p-smooth, then p and n are coprime.
We establish the bijection from ℕ × smoothNumbers p to smoothNumbers (p+1)
given by (e, n) ↦ p^e * n when p is a prime. See Nat.smoothNumbers_succ for
when p is not prime.
Equations
- Nat.equivProdNatSmoothNumbers hp = ((Equiv.prodCongrRight fun (x : ℕ) => Equiv.setCongr ⋯).trans (Nat.equivProdNatFactoredNumbers hp ⋯)).trans (Equiv.setCongr ⋯)
Instances For
Smooth and rough numbers up to a bound #
We consider the sets of smooth and non-smooth ("rough") positive natural numbers ≤ N
and prove bounds for their sizes.
The k-smooth numbers up to and including N as a Finset
Equations
- N.smoothNumbersUpTo k = {n ∈ Finset.range (N + 1) | n ∈ k.smoothNumbers}
Instances For
The positive non-k-smooth (so "k-rough") numbers up to and including N as a Finset
Equations
- N.roughNumbersUpTo k = {n ∈ Finset.range (N + 1) | n ≠ 0 ∧ n ∉ k.smoothNumbers}
Instances For
A k-smooth number can be written as a square times a product of distinct primes < k.
The set of k-smooth numbers ≤ N is contained in the set of numbers of the form m^2 * P,
where m ≤ √N and P is a product of distinct primes < k.
The cardinality of the set of k-smooth numbers ≤ N is bounded by 2^π(k-1) * √N.
The set of k-rough numbers ≤ N can be written as the union of the sets of multiples ≤ N
of primes k ≤ p ≤ N.
The cardinality of the set of k-rough numbers ≤ N is bounded by the sum of ⌊N/p⌋
over the primes k ≤ p ≤ N.