b2KIT

Prime Number Checker & Generator

Check if a number is prime and generate prime numbers up to any limit with factorization display.

Tested tool guide Tested browser tools Checked August 16, 2026

What Prime Number Checker & Generator does, with a checked example

Enter a whole number and the tool says whether it is prime, returning a verdict and, for composite inputs, the prime factorization with exponents. It also generates the complete ascending list of primes at or below any limit you choose. The results that surprise people most are the status of 1, which is neither prime nor composite, and of 2, the only even prime. For composites, read the factorization carefully: a repeated factor appears once with an exponent, so 12 is shown as 2^2 x 3, not as 2 x 2 x 3.

Worked example

A concrete input and expected output from the current implementation.

Input

360

Expected output

360 is not prime. Prime factorization: 2^3 x 3^2 x 5

360 divides by 2 three times (360 to 180 to 90 to 45), then by 3 twice (45 to 15 to 5), and 5 is prime. Every integer greater than 1 has exactly one prime factorization, so this is the only way to write 360 as a product of primes.

How the result is produced

1

The square-root bound

A composite number n always has a factor no larger than the square root of n, because in any product a x b = n at least one factor is at most the square root. Testing divisors only up to that bound is enough: the first exact division reveals a factor and drives the factorization display, and a sweep with no hits means prime. Work scales with the square root of the input, not the input itself.

2

Building the list by elimination

Generating primes up to a limit works by elimination: list the integers from 2 upward, take the smallest unmarked number as a prime, mark every multiple of it as composite, and repeat until the limit is reached. Whatever remains unmarked is prime, so the output is the complete ascending list of primes at or below the limit. The limit itself appears in the list only when it is prime.

Good uses

  • Verifying a candidate number before building on it, such as a puzzle answer, a homework factorization, or a number you plan to quote as prime.
  • Assembling every prime below a round limit such as 1000 for a lesson plan, a worksheet answer key, or a classroom poster.
  • Decomposing a composite into its prime factors to reduce a fraction, simplify a square root, or compare factorizations for GCD and LCM problems.

Limits and checks

  • 1 is not prime: it has exactly one positive divisor, itself, so it is neither prime nor composite, and the tool reports it as not prime. Zero and negative integers are also outside the definition. If an old textbook told you 1 counts, it was wrong; the primes start at 2.
  • The limit is inclusive: generating to 100 returns every prime at or below 100, ending at 97, because the limit itself appears only when it is prime; 99 and 100 never appear. Mind the volume as well: there are 78,498 primes below one million and 664,579 below ten million, so a careless limit floods the page with results.
  • Exactness stops somewhere: plain in-browser integer arithmetic is exact only up to 9,007,199,254,740,991 (2^53 - 1), and unless the tool uses a big-integer path, inputs above that range can round silently. For numbers that large, cross-check the verdict with a second calculator before relying on it.

Common questions

Why is 2 prime when it is even?

Primality has nothing to do with parity. A prime is an integer greater than 1 with exactly two positive divisors, and 2 has exactly those: 1 and 2. Every other even number is divisible by 2, so it has at least three divisors. That makes 2 the only even prime, and it is also the smallest prime of all.

Is there a largest prime number?

No. Euclid proved in the Elements (Book IX, Proposition 20) that the primes are infinite, so no generator can print them all; any limit you enter is just a slice of the list. The largest known prime is always a Mersenne prime, of the form 2^p - 1, and the record is retired roughly every couple of years by the GIMPS project, so the current holder is best looked up rather than memorized.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools