How to Use
- Enter a number
Type a positive integer to check for primality.
- Run the check
Click the Check button to determine whether the number is prime.
- View results
See the primality verdict, list of divisors, and prime factorization.
What is a prime number?
A prime number is a natural number greater than 1 whose only divisors are 1 and itself. Numbers with exactly two divisors, such as 2, 3, 5, 7, 11, and 13, are prime, while 4, 6, 8, and 9, which have three or more divisors, are classified as composite numbers.
Primes are like the 'atoms of multiplication' from which every natural number is built. According to the fundamental theorem of arithmetic, every natural number greater than 1 can be factored into a product of primes in exactly one way.
Why it matters
- Cryptography: RSA public-key encryption draws its security from the difficulty of factoring the product of two large primes back into its factors.
- Reducing fractions: Knowing the prime factors of the numerator and denominator lets you reduce a fraction to its lowest terms with ease.
- Number theory: There are infinitely many primes (Euclid's proof), yet their distribution remains one of the great unsolved problems.
Calculation Formula
This checker applies trial division with the 6k±1 optimization. If n is composite, one of its divisors must be no greater than √n, so after first filtering by 2 and 3 it tests only i and i+2 starting from 5 while i*i ≤ n.
Key conditions: n < 2 → not prime, and if n % i === 0 ever holds true, the number is composite.
For example, since √97 ≈ 9.85, you only need to try dividing 97 by 2, 3, 5, and 7. None of them divide it evenly, so 97 is prime. By contrast, 91 gives 91 ÷ 7 = 13, so 91 = 7 × 13 and is composite.
Prime factorization divides by the smallest primes in turn, grouping repeated factors as powers. Example: 360 = 2³ × 3² × 5.