The Prime Number Checker tells you whether an integer is prime, lists all of its factors, shows its prime factorization, and finds the next prime after it. Paste a number and the full picture arrives at once: a primality verdict, the complete sorted factor list, the factorization grouped with exponents (such as 2^3 x 3^2 x 5), and the next prime number above your input.
How It Works
The checker uses optimized trial division: after handling small cases and divisibility by 2 and 3, it only tests candidate divisors of the form 6k plus or minus 1 up to the square root of the number, because every prime above 3 has that form and any factor larger than the square root would pair with one smaller. Factors are collected in pairs around the square root and sorted, and the prime factorization is built by repeated division, prime by prime. Negative inputs are evaluated on their absolute value for factors and the next-prime search, matching the mathematical convention that primality is a property of the magnitude.
Worked examples
29 is prime: no divisor up to its square root (about 5.4) divides it, its only factors are 1 and 29, and the next prime is 31. The classic impostor 91 looks prime and is not: 91 = 7 x 13, so its factors are 1, 7, 13, 91 and its factorization is 7 x 13. And 360 factorizes as 2^3 x 3^2 x 5 (that is, 2 x 2 x 2 x 3 x 3 x 5), and has 24 factors: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, and 360, exactly matching the divisor-count formula (3+1)(2+1)(1+1) = 24.
Why the square root is enough
Factors come in pairs that multiply to the number: for 360, 8 pairs with 45, 12 with 30, 18 with 20. Once the search passes the square root, every remaining factor's partner has already been found, so continuing would only rediscover the same pairs in reverse. That single insight turns an impossible check on a large number into a merely heavy one, and it is why the checker stays instant for classroom-sized inputs. True cryptographic primes, hundreds of digits long, need probabilistic tests instead, because even square-root trial division on a 300-digit number would outlast the universe.
Reading the factorization
The factorization with exponents is the number's fingerprint: every integer above 1 has exactly one. From it you can read off properties instantly: the total factor count is the product of (exponent + 1) values; a number is a perfect square exactly when every exponent is even; and the greatest common divisor of two numbers takes the smaller exponent of each shared prime. The plain factor list the checker returns is just all combinations of those primes multiplied out, sorted.
Limitations
Inputs must be integers inside the safe-integer range; beyond that, floating-point representation itself lies about the number, and the checker refuses rather than guess. Trial division is exact but not instant for very large inputs near the top of the range, where a many-digit prime demands billions of divisions; expect a pause on extreme values, and use dedicated primality software for cryptographic-scale numbers.
Frequently Asked Questions
Is 1 a prime number?
No. One is neither prime nor composite, by definition: a prime has exactly two distinct positive divisors, and 1 has only one. The definition is chosen so that prime factorization stays unique.
Is 2 the only even prime?
Yes. Every other even number is divisible by 2 and therefore has at least three divisors (1, 2, and itself). Two is prime because its divisors are exactly 1 and 2.
Why does the checker use the absolute value for negatives?
Primality is conventionally defined for positive integers. For a negative input the checker reports on the magnitude, so -7 is treated through 7's properties, keeping the factor and factorization output meaningful.