Prime Number Formulas — Definition, Formula & Examples
Prime number formulas are a collection of well-known results in number theory that describe properties of prime numbers, estimate how many primes exist below a given value, or test whether a number is prime.
These formulas include Wilson's theorem ( iff is prime), the prime number theorem ( as ), and Euler's product formula ( for ), among others.
Key Formula
Where:
- = A positive integer being tested for primality
- = The factorial of p − 1, i.e., the product 1 · 2 · 3 · … · (p − 1)
How It Works
Different formulas serve different purposes. Wilson's theorem gives an exact primality test: compute modulo , and if the result is (equivalently ), then is prime. The prime counting function counts primes up to , and the prime number theorem approximates it as . For example, , while —a rough but useful estimate that improves in relative accuracy for larger . Euler's product formula connects primes to the zeta function and is foundational in analytic number theory.
Worked Example
Problem: Use Wilson's theorem to verify that 7 is prime.
Compute (p−1)!: Calculate 6! = 720.
Reduce modulo p: Divide 720 by 7. Since 720 = 102 × 7 + 6, the remainder is 6.
Check the condition: Wilson's theorem requires (p−1)! ≡ −1 (mod p). Since −1 ≡ 6 (mod 7), the condition holds.
Answer: Since 6! ≡ −1 (mod 7), Wilson's theorem confirms that 7 is prime.
Why It Matters
These formulas appear throughout number theory courses and competition math. The prime number theorem is central to cryptography, where estimating the density of large primes determines how quickly key-generation algorithms can find them. Wilson's theorem, while computationally expensive, underpins several theoretical proofs about the structure of modular arithmetic.
Common Mistakes
Mistake: Thinking Wilson's theorem is a practical way to test large numbers for primality.
Correction: Computing (n−1)! grows astronomically fast, making this test impractical for large n. It is mainly a theoretical tool. For actual primality testing, algorithms like Miller-Rabin are used instead.
