Prime Number Filter

Sweep a range, paste a list, or test one number up to 16 digits. Click any result to see its factors and why it passes or fails.

Try

The end value stops at 1,000,000,000,000. One scan covers up to 50,000 numbers, so wider jobs run in windows.

91 looks prime. It is not.

91 is the classic trap.

Odd. Ends in 1. Survives division by 2, 3 and 5. Then 7 × 13 = 91. The board above stamps each composite with its smallest factor in the corner, so 91 wears a 7. A prime such as 89 wears nothing. Only 1 and 89 divide it.

A prime is a whole number above 1 with exactly two divisors, 1 and itself. A composite has three or more. Zero and one sit outside both groups on purpose: count 1 as prime and 6 gains endless factorizations (2 × 3, 1 × 2 × 3, 1 × 1 × 2 × 3), which breaks the rule that every number splits into primes in exactly one way.

Prime
Exactly two divisors. 2, 3, 5, 7, 11.
Composite
Three or more divisors. 4, 6, 91.
Twin primes
Two primes with a gap of 2, like 71 and 73. The inspector tags them.
Mersenne prime
A prime one below a power of two, such as 31 (2⁵ − 1) or 8,191 (2¹³ − 1). Nearly every record-sized prime is this type.
Carmichael number
A composite that fools the Fermat primality test for every base sharing no factor with it. 561 is the smallest.

Stop at the square root

Testing 221 by hand? Do not divide by every number up to 220.

Factors come in pairs that multiply to the target. One member of every pair sits at or below the square root, so the search ends there. √221 is about 14.9, which leaves 2, 3, 5, 7, 11 and 13 to try. The last one hits: 13 × 17 = 221.

Number√nPrimes to testOutcome
919.542, 3, 5, 77 × 13, composite
979.852, 3, 5, 7No divisor, prime
22114.872, 3, 5, 7, 11, 1313 × 17, composite
1,00931.76The 11 primes up to 31No divisor, prime
9,007,199,254,740,88194,906,265.6Too many for paperMiller-Rabin says prime

Software uses the same cutoff. Trial division clears a nine-digit number in a blink. Near 15 digits it starts to drag, which is why this page switches to Miller-Rabin for primality and keeps trial division only for splitting composites into factors.

Pulling IDs out of a spreadsheet column? Strip repeats with the remove duplicates tool first, though the list tab also merges repeats by itself.

Primes thin out, slowly

Euclid showed around 300 BC that primes never run out. They do get rarer. Near a number n, roughly one integer in ln(n) is prime.

Up toPrimesShare1/ln n estimate
1002525%21.7%
1,00016816.8%14.5%
10,0001,22912.3%10.9%
100,0009,5929.6%8.7%
1,000,00078,4987.8%7.2%
1,000,000,00050,847,5345.1%4.8%

The estimate runs low for small numbers and closes in as they grow. Scan 1 to 50,000 above and watch the bars sag toward the right edge. The Share tile prints the estimate under its own figure, so you see the gap on any window you pick.

One pattern holds without exception. Past 2 and 5, every prime ends in 1, 3, 7 or 9. The reverse fails: 21, 27 and 49 all end in one of those digits.

Where this page stops

Not a key generator. Real RSA primes run about 300 digits each. This page tops out at 16, so use it to learn the idea or check homework, never to produce anything you plan to encrypt with.

The Fermat fools sample loads 561, 1,105, 1,729 and four more Carmichael numbers. Each passes a common shortcut test and each is composite. Click them and the inspector tags the family, because every one splits into at least three distinct primes.

Where primes earn their keep

Need the whole divisor list or factor pairs for one number? The factor calculator prints them. To watch the elimination step by step, the Sieve of Eratosthenes animates it for numbers up to 1,000. Numbers equal to the sum of their proper divisors, like 6 and 28, belong to the perfect number finder.

Myths worth retiring

ClaimVerdictCounterexample
Odd numbers are primeFalse9, 15, 91
2 is not prime because it is evenFalse. It has exactly two divisors.2 is the only even prime
A last digit of 1, 3, 7 or 9 means primeNecessary past 5, never sufficient21, 27, 49
1 is the first primeFalse by conventionUnique factorization would break
Every even number above 2 is a sum of two primesChecked past 4 × 10¹⁸, never provenNone found (Goldbach)

Splitting a column of numbers by parity first? The even and odd filter removes half the candidates before you paste.

Prime checking questions

Limits, skipped entries, slow factoring, and what the numbers on the board mean.

How big a range will one scan take?

The end value stops at 1,000,000,000,000, and a scan covers up to 50,000 numbers. To cover 200,000 numbers, run four windows and copy each result. Cost follows the span, so a window near a trillion runs about as fast as one near 100.

Why was one of my list entries skipped?

Only whole numbers from 0 to 9,007,199,254,740,991 are read. Decimals, negatives, text, and values with a thousands comma are skipped. A banner above the board names the first few so you see what was dropped.

Is the answer a guess for a 16-digit number?

No. The test uses Miller-Rabin with 12 fixed bases, which is exact for every integer below 3.3 × 10²⁴. Randomized versions leave a tiny error chance. This one has none at the sizes the page accepts.

Why does factoring a large number pause?

Proving a number prime or composite is fast. Splitting a composite is not. The page divides by 2, 3, then 6k ± 1 candidates up to the square root, and a product of two 8-digit primes needs around 15 million steps. It stops after 3 seconds and shows what is left unsplit.

What do the small numbers in the corner of a cell mean?

Each composite cell carries its smallest prime factor. A 7 in the corner of 91 tells you 7 divides it. In list mode the label appears only when that factor is below 1,000. The inspector finds larger ones.

Is 1 prime? What about 0?

Neither. A prime needs exactly two divisors and 1 has one. Zero is divisible by every number, so it has no fixed divisor set. Both show a dashed cell on the board.

What is the Share tile compared with?

It compares the real prime share of your window with 1/ln n at the window midpoint. The estimate is rough for small windows, and below 100 numbers it is left off.

Does anything leave my browser?

No. Sieving, testing and factoring all run in the page. Nothing is posted anywhere, and a refresh returns the 1 to 100 sample.