Prime Factorization
Decompose any number into its prime factors. Instant result with the complete factorization.
What is prime factorization?
To factor a number is to write it as a product of prime numbers. By the Fundamental Theorem of Arithmetic, every integer greater than 1 has one unique prime factorization. Take 360 as an example: it works out to 2³ × 3² × 5.
This factorization is what GCD and LCM algorithms, RSA cryptography and much of number theory build on.
Prime factorisation and the fundamental theorem of arithmetic
The fundamental theorem of arithmetic states that every integer greater than 1 has a unique factorisation as a product of primes, up to the order of the factors. So 60 = 2² · 3 · 5 and no other prime-power combination produces 60. The simplest method to compute this is trial division: divide by 2 while possible, then 3, then 5, 7, 11... up to sqrt(n) — if nothing divides up to that point, what remains is itself prime. Example: 16 = 2⁴; 60 = 2 · 30 = 2 · 2 · 15 = 2² · 3 · 5.
Trial division is O(sqrt n) in the worst case. For numbers with hundreds of digits, faster algorithms are used: Pollard's rho (good for finding small factors), the quadratic sieve, and the general number field sieve (GNFS) — the asymptotically best classical algorithm and the one that holds the current public records for large RSA challenge numbers.
Why factorisation matters
- RSA cryptography relies on the practical difficulty of factoring the product of two large primes. Standard key sizes today are 2048 or 4096 bits.
- Counting divisors: if
n = p₁^e₁ · p₂^e₂ · ..., the number of positive divisors isd(n) = (e₁ + 1)(e₂ + 1).... For 60 = 2² · 3 · 5 that gives 3 · 2 · 2 = 12 divisors. - Sum of divisors and other multiplicative functions are computed from the factorisation as well.
- Shor's algorithm on a sufficiently large quantum computer would factor in polynomial time, breaking RSA — which is why post-quantum cryptography is now a major area of research.
FAQ
Why stop trial division at sqrt(n)? If n = a · b with a ≤ b, then a ≤ sqrt(n). Any factor beyond sqrt(n) would already have been caught by a smaller pairing.
Is 1 a prime number? No. By modern convention 1 is excluded so that the uniqueness in the fundamental theorem holds (otherwise we could multiply by 1 any number of times).
How large can this calculator handle? Trial division comfortably handles numbers up to about 10¹² in a fraction of a second. Beyond that the runtime grows quickly and an industrial-strength library (or a sieve) is needed.
How do you factor a prime? A prime p factors trivially as p = p¹. The calculator returns the number itself with exponent 1.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.
Decompose a number into prime factors
Any integer greater than 1 can be written as a product of primes, and that's its factorisation. The decomposition serves as the basis for understanding divisibility, GCD, LCM and quite a bit beyond that. This tool breaks the number you choose into its primes.
Type the number and get the full factorisation, with each prime factor and how many times it appears (360 = 2³ × 3² × 5, for example). It's good for maths exercises, for simplifying fractions, finding divisors or just understanding how a number is built on the inside.
Without doing the successive divisions on paper, the calculation runs in the browser. A direct tool for prime factorisation.