A complete guide — with methods and examples — to the definition of a prime number, primality testing, prime factorization, and coprime numbers.
A prime number is a natural number greater than 1 that is divisible only by 1 and itself. Numbers like 2, 3, 5, 7, 11, 13... are prime; every prime except 2 is odd. Numbers greater than 1 that aren't prime are called composite (e.g. 4, 6, 8, 9); the number 1 is, by definition, neither prime nor composite. By the fundamental theorem of arithmetic, every integer greater than 1 can be written as a product of prime factors in exactly one way — that's exactly what this tool computes.
How can you tell if a number is prime?
Quick answerThe simplest method is trial division: divide the number by every integer from 2 up to its square root; if none of them divide evenly, the number is prime. This method is fast for small numbers but slows down dramatically for large ones (say, 15+ digits). That's why large numbers use fast, probabilistic-deterministic primality tests like Miller-Rabin instead; this tool automatically picks the appropriate method.
- Trial division: gives an instant result for small numbers (up to a few million).
- Miller-Rabin test: with the right set of witness values, gives a certain result for numbers up to 18 digits, and is far faster than trial division.
- Pollard's rho algorithm: finds the factors of large composite numbers with far fewer operations than trial division.
How do you find the prime factorization of a number?
Quick answerStarting from the smallest prime (2), divide the number repeatedly until it no longer divides evenly, then move on to the next prime (3, 5, 7...); this continues until the remaining quotient is 1. The result is written as an exponential product: for example, 360 = 2³ × 3² × 5. This decomposition is unique for every number (aside from ordering).
What are the prime numbers from 1 to 100?
Quick answerThere are 25 prime numbers from 1 to 100: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97. The largest is 97. You can see this list — or scan a larger range — instantly in the "Scan a range" tab above.
What is the Sieve of Eratosthenes?
Quick answerDating back to the 3rd century BC, this method eliminates the multiples of every prime, starting from 2; whatever isn't eliminated is prime. It's simple yet extremely fast even for large ranges; this tool uses exactly this algorithm for its range scan.
What does it mean for two numbers to be coprime?
Quick answerTwo numbers are coprime if they share no common factor other than 1 — that is, their greatest common divisor (GCD) is 1 — without either number needing to be prime itself. For example, 8 and 15 are coprime (GCD = 1) even though neither one is prime. The "Are they coprime?" tab checks this instantly by computing the GCD.