Prime Number Checker & Factorization
This calculator does two things at once: it tells you whether a whole number is prime, and it breaks that number down into its prime factors, updating as you type. A prime number is a whole number greater than 1 whose only divisors are 1 and itself — like 2, 3, 5, 7 and 11. Every number that is not prime (a composite number) can be written as a unique product of prime factors, which is the basis of much of number theory and of algorithms used in cryptography.
Is it prime?
Prime factors
A prime number is only divisible by 1 and itself. The factorization shows the prime factors multiplied together.
Publicidad
How it works
To check whether a number n is prime, the calculator handles the small cases (numbers below 2 are never prime, 2 and 3 are prime) and then tries dividing n by every odd number from 3 up to the square root of n. If any of them divides n exactly, n is composite; if none does, n is prime. Testing only up to the square root works because if n has a divisor larger than its square root, it must also have a matching one smaller than it. For the factorization, the calculator divides out the smallest possible factor repeatedly: it keeps dividing by 2 while it can, then by 3, then by 5, and so on, collecting each factor until nothing is left. For 60 that gives 2 × 2 × 3 × 5, and for a prime like 97 the only factor is 97 itself.
Prime numbers up to 100
There are exactly 25 prime numbers between 1 and 100. The number 2 is the only even prime: every other even number is divisible by 2, so from there on all primes are odd (though not every odd number is prime, such as 9 = 3 × 3 or 15 = 3 × 5). A classic way to find them is the Sieve of Eratosthenes: write the numbers from 2 upward and cross out the multiples of each prime (the multiples of 2, then of 3, then of 5…); whatever is left uncrossed is prime. Here is the full list up to 100.
| Range | Prime numbers |
|---|---|
| 1 – 50 | 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 |
| 51 – 100 | 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 |
How to check whether a number is prime by hand
To tell whether a number n is prime, it is enough to test whether any number from 2 up to the square root of n divides it. If none divides it exactly, n is prime. For example, the square root of 97 is about 9.85, so you only need to test 2, 3, 5 and 7: since none of them divides it, 97 is prime. By contrast 91 looks prime at first glance, but 91 = 7 × 13, so it is composite. Testing only up to the square root works because if n had a divisor larger than its root, the quotient would be a smaller divisor we would already have found earlier.
Publicidad
Preguntas frecuentes
- What is a prime number?
- A prime number is a whole number greater than 1 that has exactly two divisors: 1 and itself. The first primes are 2, 3, 5, 7, 11, 13 and 17. The number 2 is the only even prime, because every other even number is divisible by 2.
- Is 1 a prime number?
- No. By definition a prime must have exactly two distinct divisors, and 1 has only one divisor (itself). For the same reason 0 and negative numbers are not prime. The smallest prime number is 2.
- What is prime factorization?
- Prime factorization is writing a number as a product of prime numbers. For example, 60 = 2 × 2 × 3 × 5. The fundamental theorem of arithmetic guarantees that every whole number greater than 1 has exactly one such factorization, apart from the order of the factors.
- How does the calculator check if a number is prime?
- It rules out numbers below 2 and even numbers above 2, then tries dividing by every odd number up to the square root of the input. If none divides it exactly, the number is prime. Stopping at the square root makes the test fast even for large numbers.
- Why is prime factorization important?
- Prime factorization underpins reducing fractions, finding greatest common divisors and least common multiples, and public-key cryptography such as RSA, whose security relies on how hard it is to factor very large numbers back into their primes.