🔢 Prime Number Tester & Factorization Generator
Prime factors, divisor count and primality — plus the square root in simplest radical form, which no other calculator derives from the factorization.
2 divisors of 97
What Prime Number Tester & Factorization Generator Does
Every whole number above 1 is either prime or splits into primes in exactly one way. That uniqueness is the Fundamental Theorem of Arithmetic, and it is the reason prime factorization is worth computing at all — the factorization is a fingerprint, not one description among several.
Finding it is conceptually simple. Divide by 2 as often as it goes, then 3, then 5, and so on, keeping a tally. You only need to test up to the square root, because if a number had two factors both above its square root their product would exceed the number itself. Once the running quotient drops to 1, the tally is the answer.
A great deal falls out of that tally for free. Whether the number is prime — it is, exactly when the tally is a single prime to the first power. How many divisors it has — multiply each exponent plus one together, no enumeration needed. And the square root in simplest radical form, which is what half the people searching for a factorization calculator actually want.
The one thing worth being upfront about is scale. Trial division needs roughly the square root of n steps, so it is fast to about 10¹⁴ and hopeless well before the numbers used in cryptography. Every browser calculator also hits a harder wall at 2⁵³, past which the number you typed is not the number being factored.
How to Use Prime Number Tester & Factorization Generator
- Enter any positive integer into the input box
- Review whether the number is Prime or Composite
- Inspect the prime factorization formula and complete list of integer divisors
Formula Used by Prime Number Tester & Factorization Generator
Prime factorization by trial division
Divide by each prime in turn, up to √n, recording how many times each divides evenly
- √n
- The stopping point — a factor pair cannot have both members above the square root
- Remaining quotient
- If anything above 1 is left at the end, it is itself prime
Worked example
100
- 100 ÷ 2 = 50, record a 2
- 50 ÷ 2 = 25, record a 2
- 25 is not divisible by 2 or 3; try 5
- 25 ÷ 5 = 5, record a 5
- 5 ÷ 5 = 1, record a 5
Result: 2 × 2 × 5 × 5, written 2² × 5²
Counting divisors without listing them
number of divisors = (e₁ + 1) × (e₂ + 1) × … for each exponent in the factorization
- eᵢ
- The exponent of the i-th prime
- +1
- Each prime can appear 0, 1, 2 … up to eᵢ times in a divisor
Worked example
100 = 2² × 5²
- The 2 can appear 0, 1 or 2 times — three choices
- Same for the 5 — three choices
- 3 × 3
Result: 9 divisors: 1, 2, 4, 5, 10, 20, 25, 50, 100
Simplifying a square root from the factorization
√n: each prime contributes p^⌊e/2⌋ outside the radical and p^(e mod 2) inside
- ⌊e/2⌋
- How many complete pairs of that prime exist — each pair escapes the radical
- e mod 2
- The leftover, 0 or 1, which stays under the radical
Worked example
√72
- 72 = 2³ × 3²
- The 3² is a complete pair, so 3 comes out
- The 2³ gives one pair (a 2 comes out) with one 2 left over
- Outside: 3 × 2 = 6. Inside: 2
Result: 6√2
Worked factorizations
Including the values people most often look up. Divisor counts come from the exponents, not from listing.
| Number | Prime factorization | Divisors | √ in simplest form |
|---|---|---|---|
| 10 | 2 × 5 | 4 | √10 |
| 20 | 2² × 5 | 6 | 2√5 |
| 21 | 3 × 7 | 4 | √21 |
| 24 | 2³ × 3 | 8 | 2√6 |
| 36 | 2² × 3² | 9 | 6 |
| 48 | 2⁴ × 3 | 10 | 4√3 |
| 50 | 2 × 5² | 6 | 5√2 |
| 72 | 2³ × 3² | 12 | 6√2 |
| 76 | 2² × 19 | 6 | 2√19 |
| 97 | 97 (prime) | 2 | √97 |
| 100 | 2² × 5² | 9 | 10 |
What the exponents tell you at a glance
The factorization answers several questions at once, which is why it is worth computing even when you only wanted one of them.
| Question | Read from the factorization |
|---|---|
| Is it prime? | Yes exactly when it is one prime to the first power |
| How many divisors? | Multiply (each exponent + 1) together |
| Is it a perfect square? | Yes exactly when every exponent is even |
| Is it a perfect cube? | Yes exactly when every exponent is divisible by 3 |
| Simplest radical form | Halve each exponent; the remainders stay inside |
| Is it a power of two? | Yes when 2 is the only prime present |
Stated limits across the field
Unusually for this project, most competitors publish their ceilings. Ours had none until now.
| Tool | Stated limit | Method |
|---|---|---|
| CalculatorSoup | Under 10 trillion (13 digits) | Trial division |
| Math is Fun | 2 to 9,007,199,254,740,991 | Trial division, capped at 2⁵³−1 |
| Number Empire | Up to 80 digits | Advanced algorithms |
| Alpertron | Very large | Elliptic curve method plus SIQS |
| This tool | 10¹⁴, and refuses past 2⁵³−1 | Trial division, with both limits stated |
How to Read Your Result
Why 1 is not prime
It looks like it should qualify — its only divisors are 1 and itself. It is excluded by definition to protect the uniqueness of factorization. If 1 were prime, then 12 could be written as 2² × 3, or 1 × 2² × 3, or 1² × 2² × 3, and so on without end. Every number would have infinitely many factorizations and the Fundamental Theorem would say nothing. Excluding 1 is a choice that makes the rest of number theory work.
Why testing stops at the square root
If n has a factor pair a × b, one of them must be at or below √n — if both exceeded it, their product would exceed n. So finding no factor at or below the square root proves there is none at all. This is what makes trial division practical for moderate numbers: checking whether 999,999,937 is prime needs about 31,600 tests rather than a billion.
The 2⁵³ wall, and why it matters here more than elsewhere
JavaScript numbers hold integers exactly only up to 9,007,199,254,740,991. Past that they round to the nearest representable value, which for factorization is uniquely damaging: 9007199254740993 becomes 9007199254740992, and those two numbers have completely different factorizations. A tool that keeps going here does not give an imprecise answer, it gives a confident answer about a different number. Refusing is the only honest option without arbitrary-precision arithmetic.
Where trial division runs out
The cost grows with the square root of n, so each two extra digits roughly multiplies the work by ten. That is fine to about 10¹⁴ and hopeless for the numbers used in RSA, which run to hundreds of digits. Serious factorization uses Pollard's rho for small factors, the elliptic curve method for medium ones, and the quadratic or number field sieve for hard cases. The difficulty of that problem is precisely what public-key cryptography is built on.
Perfect squares and radicals
A number is a perfect square exactly when every exponent in its factorization is even — 36 is 2² × 3², so its root is 2 × 3 = 6 with nothing left over. When some exponent is odd, that prime cannot be fully paired and stays under the radical. This is the whole method for simplifying surds by hand, and it generalizes: for a cube root, take out primes in groups of three instead of pairs.
Limitations & Accuracy Notes
- Inputs above 9,007,199,254,740,991 are refused rather than approximated, because past that point the value being factored would differ from the value entered.
- A practical ceiling of 10¹⁴ applies regardless, since trial division needs about √n steps and would otherwise freeze the page.
- The full divisor list is shown only when it is short and the number is moderate. The divisor count is always exact, since it comes from the exponents rather than from enumeration.
- Trial division is the wrong algorithm for large numbers. Anything with a large semiprime structure — two big prime factors — needs Pollard's rho, the elliptic curve method or a sieve.
- Only positive integers are handled. Negative numbers, zero and non-integers have no prime factorization in the ordinary sense.
Frequently Asked Questions
What is a prime number?
What is the prime factorization of 24?
How do I simplify a square root using prime factorization?
How many divisors does a number have?
Why is there a size limit?
Is 1 a prime number?
Is 2 really prime?
How do you test whether a number is prime?
Why does prime factorization matter outside maths class?
How large a number can this handle?
Is my data stored?
References & Further Reading
- NIST Digital Library of Mathematical Functions — Number theory — US National Institute of Standards and Technology reference covering primes, divisor functions and the Fundamental Theorem of Arithmetic
- CalculatorSoup — Prime Factorization Calculator — The most thorough competing page; its worked examples for 100, 76, 50, 48, 36, 20 and 10 were reproduced to cross-check the factorization here