Connect via MCP →

Enter Calculation

Formula

Formula: Factoring Calculator
Show calculation steps (1)
  1. Prime factorization

    Prime factorization: Factoring Calculator

    Every integer greater than 1 is a unique product of prime powers.

Advertisement

Results

Prime Factorization of 21
21 = 3 × 7
this number is composite
Number of factors 4
All factors 1, 3, 7, 21
Factor pairs (1, 21), (3, 7)

What is the Factoring Calculator?

This tool takes any whole number and finds everything you need to know about its divisibility: the complete list of positive factors, all of its factor pairs, its prime factorization, and whether it is prime or composite. Factoring is a core skill in arithmetic, algebra, and number theory, and this calculator does the trial division for you instantly.

How to use it

Type an integer into the "Find the Factors of:" box and submit. Negative numbers are accepted - the calculator factors the absolute value, since factors are positive by convention. Decimals are rounded to the nearest integer. The results panel shows the prime factorization as the headline, with the factor count, full factor list, and factor pairs below.

The formula explained

To find every factor of \(N\), we only need to test possible divisors up to the square root of \(N\). For each divisor \(i\) that divides \(N\) evenly, both \(i\) and \(N/i\) are factors. This means we only check

$$i \le \lfloor \sqrt{N} \rfloor$$

This is far faster than checking every number up to \(N\). The prime factorization repeatedly divides out the smallest prime (2, then 3, 5, 7, ...) until only 1 remains, recording each prime and how many times it appears as an exponent.

$$N = p_1^{a_1} \times p_2^{a_2} \times \cdots \times p_k^{a_k}$$
Advertisement
Prime factorization of 60 shown as a factor tree branching into prime factors 2, 2, 3, 5
A factor tree breaks a number down into its prime factors.

Worked example: 21

The square root of 21 is about 4.58, so we test 1, 2, 3, 4. We find \(21 = 1 \times 21\) and \(21 = 3 \times 7\), giving factors 1, 3, 7, 21 (four factors) and pairs (1, 21) and (3, 7). Dividing 21 by 3 leaves 7, which is prime, so

$$21 = 3 \times 7$$

Because it has more than two factors, 21 is composite.

Factor pairs of 21 shown as rectangle arrays: 1 by 21 and 3 by 7
The number 21 has two factor pairs: \(1 \times 21\) and \(3 \times 7\).

FAQ

Is 1 prime or composite? Neither. By definition a prime has exactly two distinct factors; 1 has only one, so it is a unit.

What about 0? Every integer divides 0, so it is undefined for factoring and reported as neither prime nor composite.

Why do perfect squares have an odd number of factors? Because the square root pairs with itself (for 36, the pair is (6, 6)), so that factor is counted once instead of twice.

Last updated: