How this instrument works
Verifying that a number equals the product of two claimed prime factors takes two separate checks: does the product actually reproduce the original number, and is each claimed factor genuinely prime? Getting either check wrong invalidates the whole claim — a correct product with a non-prime 'factor' isn't a genuine PRIME factorization at all, and a wrong product means the numbers don't even multiply out correctly in the first place.
The primality check reuses this site's own Prime Number page's method directly: Fermat's Little Theorem, testing whether 2 raised to one less than the candidate, taken modulo the candidate itself, comes back to exactly 1 — a fast, reliable primality test for the small primes this page's examples use.
This page checks a SPECIFIC claimed factorization rather than searching for one from scratch, since the DSL underlying this site's calculators has no way to try every possible divisor of a number in sequence — but verifying a given claim, the two checks this page performs, needs no such search at all.
- Enter the number being factored into the n field.
- Enter the two claimed prime factors into the p and q fields.
- Read Product test: 0 confirms p×q equals n exactly.
- Read Primality test for p and q: 1 confirms each one passes the Fermat primality test.
Worked example — verifying 15 = 3 × 5
For 15, claimed to factor as 3×5: the product test comes out to 15−15=0, confirming the product matches. Both 3 and 5 pass the Fermat primality test with a result of 1, confirming they're genuinely prime — together, both checks confirm 15's prime factorization really is 3×5.
For 21, claimed to factor as 3×7: the product test is 21−21=0, and both 3 and 7 pass as prime. Testing 20 against a claimed factorization of 3×5 instead: the product test comes out to 20−15=5, nonzero — 3×5=15 does NOT equal 20, so this particular claim is wrong, even though 3 and 5 are each still individually prime.
Questions
What two things does verifying a prime factorization require?
Confirming the claimed factors actually multiply back to the original number, and separately confirming each claimed factor is genuinely prime — both checks must pass together for a claim to be a valid prime factorization.
How does the primality test work?
It applies Fermat's Little Theorem, the same method this site's Prime Number page uses: raising 2 to one less than the candidate and taking that result modulo the candidate itself — a result of 1 is strong evidence (though not an absolute guarantee) of primality.
Why does this page verify a claim instead of searching for the factors itself?
Finding prime factors from scratch needs testing a sequence of candidate divisors, which this site's calculator engine has no built-in way to do; checking a SPECIFIC given claim, by contrast, needs only the two direct tests this page performs.
What does a nonzero product test mean?
That the claimed factors don't actually multiply back to the original number — the factorization claim is simply wrong, regardless of whether the individual claimed factors happen to be prime.
Can the primality test ever be wrong?
Extremely rarely — certain composite numbers, called Fermat pseudoprimes, can pass this specific test despite not being prime, though this is uncommon for the small numbers this page's examples use.