Prime Factorization Calculator

Factor integers into prime powers

Factor a positive integer into its prime factors, written in prime-power form \(n = p_1^{a_1} \cdots p_k^{a_k}\). See whether your number is prime or composite, view all divisors, and get key number-theory statistics such as the number of divisors and sum of divisors.

Use this tool for simplifying fractions, computing GCF/LCM, building factor trees, and preparing examples for classes or contest training.

1. Factor a single number

Optimised for n up to about 1010. For very large n, trial division may be slow.

Prime factorization
Prime / composite
Number of divisors τ(n)
Sum of divisors σ(n)
All positive divisors of n
Prime factor tree (text view)

2. Factor multiple numbers at once

Paste a list of integers to quickly see their factorizations side by side – useful for building exercises or comparing patterns.

Separate by commas, spaces or new lines. Values < 2 are ignored.

n Prime factorization Prime/composite τ(n) σ(n)

3. Factor table 2 ≤ n ≤ N

Generate a compact table of prime factorizations up to N, ideal for spotting patterns such as powers of primes, highly composite numbers, and behaviour of τ(n) and σ(n).

Table includes all integers from 2 up to N.

Tip: set N = 30 to get a classic classroom reference table of prime factorizations.

n Prime factorization Prime?

Definition of prime factorization

A prime factorization of an integer \(n \ge 2\) is a representation of n as a product of prime numbers:

\[ n = p_1^{a_1} p_2^{a_2} \cdots p_k^{a_k}, \]

where each \(p_i\) is prime, the \(p_i\) are distinct, and the exponents \(a_i\) are positive integers.

The Fundamental Theorem of Arithmetic guarantees that this factorization is unique up to the order of the primes. This uniqueness makes prime factorization the backbone of many number-theory results and applications.

Example: prime factorization of 360

Using repeated division by small primes:

  1. \(360 = 2 \cdot 180\)
  2. \(180 = 2 \cdot 90\)
  3. \(90 = 2 \cdot 45\)
  4. \(45 = 3 \cdot 15\)
  5. \(15 = 3 \cdot 5\)

Collecting equal primes gives \[ 360 = 2^3 \cdot 3^2 \cdot 5. \]

Divisors, number of divisors and sum of divisors

Once we know the prime factorization of \(n\), we can compute many arithmetic functions easily:

  • Number of positive divisors: \[ \tau(n) = (a_1 + 1)(a_2 + 1)\cdots(a_k + 1). \]
  • Sum of positive divisors: \[ \sigma(n) = \frac{p_1^{a_1+1}-1}{p_1-1} \cdots \frac{p_k^{a_k+1}-1}{p_k-1}. \]

The calculator uses these formulas to display τ(n) and σ(n) and to generate the list of all divisors.

Prime factorization and other topics

GCF, LCM and simplifying fractions

For two integers a and b, their greatest common factor (GCF) and least common multiple (LCM) can be read off from prime factorizations:

If \[ a = p_1^{\alpha_1} \cdots p_k^{\alpha_k}, \quad b = p_1^{\beta_1} \cdots p_k^{\beta_k}, \] then \[ \gcd(a, b) = p_1^{\min(\alpha_1,\beta_1)} \cdots p_k^{\min(\alpha_k,\beta_k)}, \] \[ \operatorname{lcm}(a, b) = p_1^{\max(\alpha_1,\beta_1)} \cdots p_k^{\max(\alpha_k,\beta_k)}. \]

To simplify a fraction \(\frac{a}{b}\), factor a and b, compute their GCF from the exponents, and divide numerator and denominator by that GCF.

Cryptography and computational limits

Modern public-key cryptosystems such as RSA rely on the fact that factoring very large integers (hundreds or thousands of bits) is computationally hard. Our calculator deliberately uses a simple algorithm for clarity and education; it is not intended for breaking cryptographic keys, only for small to medium-size integers that fit comfortably into standard number-theory and algebra problems.

FAQ: using this prime factorization calculator

What happens for n = 0 or n = 1?

The prime factorization is defined only for integers \(n \ge 2\). The cases \(n = 0\) and \(n = 1\) are special: 0 is divisible by every integer and 1 has no prime factors. The calculator treats them as special inputs and does not attempt a standard factorization.

Does the tool always find the factorization if it exists?

For the intended input range, yes. Every integer \(n \ge 2\) has a prime factorization, and the trial division method will eventually find it. If you enter extremely large numbers, the computation may become slow; in that case you should use more specialised software.

Can I use this in class or for homework?

The tool is designed to be transparent and didactic. It shows prime-power notation, divisors, and factor trees. It is perfect for checking manual work and generating examples, but for exams you should follow your teacher’s policy on calculator use and be prepared to reproduce steps by hand.