Check whether a number is prime, see its prime factorization, and find the nearest prime numbers before and after it.
Google AdSense Banner
This area will contain advertisements after approval.
Google AdSense Banner
This area will contain advertisements after approval.
A prime number is a whole number greater than 1 with no divisors other than 1 and itself. This calculator checks primality by trial division, testing whether any number up to the square root of your input divides evenly into it. If none do, the number is prime.
Every whole number greater than 1 can be broken down into a unique product of prime numbers, called its prime factorization. This calculator repeatedly divides your number by the smallest possible prime factor until only 1 remains, listing each prime factor found along the way.
For 97: checking primality only requires testing divisors up to √97 ≈ 9.85, so divisors 2 through 9. None of 2, 3, 4, 5, 6, 7, 8 or 9 divide evenly into 97, so 97 is prime, and its prime factorization is just 97 itself. The next prime after 97 is 101 (98, 99 and 100 are all divisible by smaller numbers), and the previous prime is 89.
For comparison, 60 is not prime: dividing repeatedly by the smallest prime factors gives 60 = 2 × 2 × 3 × 5.
Assuming you need to test every number up to your target to check primality, you only need to test divisors up to the square root of the number, since any factor larger than the square root would need a matching factor smaller than it.
Thinking 2 is not prime because it's even, 2 is the only even prime number, every other even number is divisible by 2 and therefore not prime.
Treating 0 or negative numbers as valid inputs, primality is only defined for whole numbers greater than 1, this calculator requires a positive whole number.
No, by definition a prime number must have exactly two distinct positive divisors: 1 and itself. The number 1 has only one divisor, so it's neither prime nor composite.
This calculator supports positive whole numbers up to 100,000,000. Very large numbers would take too long to check using this method in a browser.
Google AdSense Banner
This area will contain advertisements after approval.