Prime Factorization Calculator: Factors and Divisors
Write any whole number up to 60 digits as a product of prime powers, list all of its divisors with their count and sum, and see the factor tree and closest factor pair. Free and private in your browser.
About the Prime Factorization Calculator
The Prime Factorization Calculator writes a whole number as a product of primes, such as 360 = 2³ × 3² × 5. The same result also gives every divisor of the number, how many there are and what they add up to, and it can rewrite the number as a product: the factor tree, every factor pair, and the two factors closest to its square root. Numbers of up to 60 digits are accepted, and the factors are exact.
Large numbers are factorised in a background worker so the page stays responsive. Everything runs in your browser; the numbers you type are never sent anywhere.
How to use it
Steps
- Choose a view: Prime factors, Divisors or As a product. You can switch views after the result appears without factorising again.
- Type a whole number from 1 up to 60 digits. Spaces, commas and underscores between digits are ignored.
- Press Factorise, or press Enter. Lists have Copy and Download .txt buttons.
Views
Prime factors shows the factorisation with exponents, the same product written out in full, and the number of distinct primes. Divisors shows the number of divisors d(n), their sum σ(n), and the full sorted list. As a product shows the pair of factors closest to the square root, every pair d × n/d, and the factor tree.
How the factors are found
Trial division first removes every prime factor below 10,000. That alone finishes most everyday numbers.
Pollard's rho method then splits what is left. It walks the sequence x ↦ x² + c modulo n, which must eventually repeat modulo each hidden prime factor p; the greatest common divisor of a difference of two terms with n then reveals p. Brent's variant of the method batches those greatest common divisors so that the work for a factor of size p is about √p steps. A 60-digit number whose factors are all small or medium is split in a moment. The search has a fixed budget: if a part with two very large prime factors cannot be split within it, the page shows that part as composite rather than hanging, and divisor lists are not shown for it.
Every factor is tested with Miller-Rabin. With the first thirteen primes as bases the test is a proof for every number below 3,317,044,064,679,887,385,961,981, about 3.3 × 10²⁴. Above that bound the page uses twenty bases, which leaves a composite less than one chance in 4²⁰ of passing, and labels such factors as probable primes.
Divisors and the product views
The number of divisors and their sum follow from the exponents:
For 360 = 2³ × 3² × 5 that gives d(360) = 4 × 3 × 2 = 24 and σ(360) = 15 × 13 × 6 = 1170. Up to 100,000 divisors are listed; above that, only the count and the sum are shown.
The pair closest to the square root is the largest divisor not above √n with its partner, so 360 = 18 × 20. For a prime p the only pair is 1 × p. The factor tree splits each composite into its smallest prime and the cofactor until only primes remain.
Worked examples
- 600,851,475,143 = 71 × 839 × 1,471 × 6,857.
- 2⁶⁴ + 1 = 18,446,744,073,709,551,617 = 274,177 × 67,280,421,310,721.
- 97 is prime, so its only divisors are 1 and 97.
- 1 has no prime factors and one divisor; 0 has no factorisation, because every number divides it.
Privacy
The factorisation runs in your browser, in a background worker for long numbers. Nothing is uploaded and nothing is stored.
Related tools
To test a single number for primality or list primes, use the Prime Number Generator. To find the greatest common divisor or least common multiple of several numbers, use the GCD and LCM Calculator. The Number List Calculator adds up a list of divisors you copy from here.
Open-source credits
- The calculator is written for this site and uses no third-party library. Arithmetic uses the browser's built-in
BigInt. - Factorisation follows J. M. Pollard, A Monte Carlo method for factorization (BIT, 1975), with the cycle detection of R. P. Brent, An improved Monte Carlo factorization algorithm (BIT, 1980).
- Primality uses the Miller-Rabin test (G. L. Miller, 1976; M. O. Rabin, 1980) with the deterministic bound for the first thirteen prime bases from J. Sorenson and J. Webster, Strong pseudoprimes to twelve prime bases (Mathematics of Computation, 2017). The tests check the divisor counts and sums against OEIS A000005 and OEIS A000203.
Frequently asked questions
What is prime factorisation?
It is writing a whole number as a product of primes, such as 360 = 2³ × 3² × 5. Every whole number above 1 has exactly one such product, apart from the order of the factors.
How big a number can be factorised?
Up to 60 digits. Numbers with small or medium prime factors split almost at once. A part made of two very large primes may not split within the time budget, and the page then marks it as composite.
How do I find how many divisors a number has?
Open the Divisors view. The count is the product of each exponent plus one, so 360 = 2³ × 3² × 5 has 4 × 3 × 2 = 24 divisors, and the page lists them all with their sum.
What does a probable prime mean here?
Below about 3.3 × 10^24 the Miller-Rabin check is a proof. Above it the page runs twenty rounds, so a composite factor would slip through with a chance below 4^-20, and such factors are labelled probable.
What is the factor pair closest to the square root?
It is the way to write the number as a × b with a and b as near to each other as possible, useful for laying items out in a grid. For 360 it is 18 × 20.