PRIME NUMBER CHECKER & GENERATOR

Check whether a number is prime, or generate every prime up to a limit or the first N primes.

97 is prime

How to check or generate primes

  1. 1

    Switch between "Check a number" and "Generate primes" mode.

  2. 2

    In check mode, type any whole number — it's tested by trial division up to its square root.

  3. 3

    In generate mode, pick either "primes up to N" (using a sieve) or "first N primes", and read the full list.

Questions

Why check for factors only up to the square root of the number?
If a number n has a factor larger than its square root, it must also have a corresponding factor smaller than the square root (since their product equals n) — so checking up to √n is guaranteed to catch any factor pair without wasted work. This is the standard trial-division shortcut, not an approximation.
What is the Sieve of Eratosthenes?
It's an ancient, highly efficient algorithm for finding every prime up to a limit: start by assuming all numbers are prime, then starting from 2, mark every multiple of each prime as composite. Whatever's left unmarked is prime. It's dramatically faster than testing each number individually, which is why "primes up to N" mode uses it here.
Why are the generator limits capped?
Generating primes up to 1,000,000 or the first 10,000 primes already takes a noticeable moment in a browser tab — capping keeps the tool responsive. For research-scale prime generation, a dedicated offline tool or library is a better fit than a browser-based utility.
Is 1 a prime number?
No — by definition, a prime number must have exactly two distinct positive divisors (1 and itself), and 1 only has one. This is why mathematicians explicitly exclude 1 from the primes, even though it might seem intuitive to include it.