Prime Number Calculator
Check if a number is prime using trial division and see its full prime factorization instantly with this free Prime Number Calculator.
Prime Number Calculator
Method
How this calculator works
A number n is prime if it is greater than 1 and has no divisor d where 2 ≤ d ≤ √n. Trial division only needs to test up to √n because any factor larger than √n would pair with a smaller factor already tested.
- Enter any positive whole number in the input field.
- The tool checks numbers less than 2 as non-prime and treats 2 and 3 as prime.
- For larger numbers it tests divisibility by every integer from 2 up to the square root of n.
- If a divisor is found the number is composite; otherwise it is prime.
- For composite numbers the calculator also displays the complete prime factorization.
Examples
Worked examples
Real numbers, end-to-end results.
Is 97 prime?
Prime
No divisor exists between 2 and 9 (√97 ≈ 9.8), so 97 is prime.
Factorize 360
360 = 2³ × 3² × 5
360 is composite because it has divisors other than 1 and itself.
Is 1 prime?
Not prime
1 has only a single divisor, so it fails the definition of a prime.
Use cases
When to use it
- Verifying primality for cryptography and RSA key generation coursework.
- Simplifying fractions by finding shared prime factors.
- Checking homework and competition math answers quickly.
- Teaching the fundamental theorem of arithmetic with worked factorizations.
FAQ
Frequently asked questions
What is a prime number?
Is 1 a prime number?
Why is 2 the only even prime?
How does the calculator test for primality?
What is prime factorization?
Related tools
All calculators →Factorial Calculator
Calculate the factorial (n!) of any non-negative integer.
LCM & HCF Calculator
Find LCM and HCF/GCD of up to 6 numbers with step-by-step methods.
Exponent Calculator
Raise any base to any power, including negative and fractional exponents.