gizmobench

Prime Number Checker

Type a whole number and this tells you whether it is prime, composite, or neither, and shows the evidence for the verdict: a composite comes back with its smallest factor and the pair that factor belongs to, and a prime comes back with the range the division covered, which runs to the number's square root. Nothing here is a probability. The answer is found by dividing by every candidate up to that square root in exact integer arithmetic, which is a proof rather than a strong suspicion, and that is why there is a stated ceiling of 1,000,000,000,000: above it the scan takes too long to finish in a browser, so the number is refused instead of being answered by a probabilistic test presented as a fact. Most numbers are settled as you type, and one that needs the full scan runs in a background worker when you press Check, so the page keeps responding and the Stop button ends the work.

600,851,475,143Compositesmallest factor 71 · 600,851,475,143 = 71 × 8,462,696,833
stopped at 71
Number
Show

600,851,475,143 is composite. Its smallest factor is 71, and 600,851,475,143 = 71 × 8,462,696,833.

Whole numbers from 0 up to 1,000,000,000,000. Thousands may be grouped in threes, as 600,851,475,143.

  • 2the only even prime
    prime
  • 1no factors above itself
    neither prime nor composite
  • 497 × 7
    composite, smallest factor 7
  • 4.5not a whole number
    4.5 is not a whole number. Prime and composite describe whole numbers only, and this will not round one for you: drop the part after the point.
Proved, not guessed, up to a stated limit. A composite number always has a factor at or below its own square root, so dividing by every candidate up to that point and finding none is a proof that the number is prime, not a strong suspicion. That is the whole method here: 2, then 3, then every number of the form 6k - 1 and 6k + 1, which is every candidate that 2 and 3 have not already ruled out. Numbers are tested by dividing by every candidate up to the square root, so a prime result is a proof and a composite result comes with the factor that settles it. That is exact up to 1,000,000,000,000. Larger numbers are refused rather than answered with a probabilistic test. A number that needs the long scan runs in a background worker, so the page keeps responding and Stop ends the work.

Common questions

How do you tell whether a number is prime?
Divide it by every candidate up to its square root. If nothing divides it, it is prime. The square root is where you can stop, because a composite number is a product of two factors and the smaller of the two is always at or below the square root: once 999,999 has been passed and nothing has divided 999,999,999,989, there is nothing left that could, because any factor above the square root would have a partner below it. This tool starts with 2 and 3, then tries only numbers of the form 6k - 1 and 6k + 1, which is every candidate that 2 and 3 have not already ruled out, so two thirds of the work disappears without changing the answer. Below 10,000 it works from a list of primes sieved when the page loads, which is the same candidates with the composites among them left out. When a divisor turns up the search stops there, which is why a composite verdict arrives with the smallest factor beside it: 49 stops at 7, and 600,851,475,143 stops at 71.
Are 0 and 1 prime numbers?
Neither of them is prime, and neither is composite, so this tool answers "neither" rather than forcing them into one box. A prime is a whole number above 1 with exactly two divisors, 1 and itself. 1 has only one divisor, so it misses the definition by one, and it is left out on purpose: if 1 counted as prime, then 6 could be written as 2 × 3 or 1 × 2 × 3 or 1 × 1 × 2 × 3, and a number would stop having a single factorization. 0 fails the other way, since every whole number divides it. Pages that label 1 composite are simply wrong, and this one says so on the stage.
What is the largest number it will check, and why is there a limit?
1,000,000,000,000, a million million. Above that the tool refuses by name instead of answering. The limit is about time, not about correctness: the hardest case at the ceiling is a prime, where the scan has to run all the way to 1,000,000, thinned by the 6k wheel to about a third of a million divisions. That is a few milliseconds of work on a laptop. Because the scan is proportional to the square root, every two digits you add multiplies the work by ten, so a sixteen-digit prime would already be a noticeably frozen tab and a twenty-digit one would be minutes. The alternative at that size is a probabilistic test, and a tool that quietly switched to one would be reporting a likelihood while looking like a proof. This refuses instead, and the message says the ceiling and the reason.
How is this different from a probabilistic prime test?
A probabilistic test, such as Fermat's or Miller-Rabin, picks witnesses and asks whether the number behaves the way a prime must. Each witness that passes makes a composite less likely, and after enough of them the chance of being wrong is tiny, but it is a chance, and the test never produces a factor: it can say "probably prime" and it can say "definitely composite", and in the composite case it usually cannot tell you what divides the number. Trial division is slower and completely different in kind. It either finds a divisor, which you can check by hand in one multiplication, or it exhausts every candidate up to the square root, which settles the question. That is why this tool has a ceiling rather than a probability, and why a composite answer here always comes with the factor that proves it.
How long does a check take, and what does Stop do?
Almost always no time at all. A composite is usually settled by one of the first few candidates, so numbers like 600,851,475,143 answer the moment you finish typing. The slow case is a prime near the ceiling, such as 999,999,999,989, where nothing divides it and the scan has to run every candidate to 999,999. The tool spends a small fixed budget of divisions on the page itself as you type, and when that budget is not enough the stage says so and Check hands the rest to a background worker, so the page keeps scrolling and typing while the scan runs. The stage shows how far it has reached, and Stop ends the worker where it stands. On a laptop the worst case is milliseconds; on an old phone it is longer, which is why the Stop button exists at all.
What happens with a decimal, a negative number or a typo?
Each is refused with a message naming what was wrong, and nothing is rounded or guessed. 4.5 comes back saying it is not a whole number, since prime and composite describe whole numbers only. A negative number is refused with a note to drop the minus sign, because prime and composite are defined here for whole numbers from 0 up. Letters are refused with a request for digits. Thousands separators are fine as long as they group in threes, so 600,851,475,143 is read as the number it looks like, while an odd comma such as 1,5 is named rather than silently read as 15.
Is my number uploaded, and what does the All factors view show?
Nothing is uploaded and nothing is sent anywhere. The arithmetic runs in your browser, the background worker is built from the page's own code, and no request is made while you type. The number in the box is remembered in this browser alone so the page opens where you left it, and the Start over button at the top of the page forgets it. Switching Show from First factor to All factors lists every divisor of the number in order, up to the first 200 of them, with the total count shown when there are more, since a number under the ceiling can have as many as 6,720 divisors. Copy puts the verdict and its evidence on your clipboard as plain text.

Numbers are tested by dividing by every candidate up to the square root, so a prime result is a proof and a composite result comes with the factor that settles it. That is exact up to 1,000,000,000,000. Larger numbers are refused rather than answered with a probabilistic test.