Number Theory & Bases

Prime Factorization Calculator

Enter any whole number to find its prime factors and write it as a product of primes, such as 360=23⋅32⋅5360 = 2^3 \cdot 3^2 \cdot 5.

Try

Any whole number up to 40 digits. Negative numbers, 0 and 1 are explained too. Commas between digit groups are fine.

Result

Prime factorization of 360: 2³ × 3² × 5

Prime factorization of 360

23⋅32⋅52^{3} \cdot 3^{2} \cdot 5

2³ × 3² × 5

Factor tree of 360
360218029024531535
Expanded form
2 × 2 × 2 × 3 × 3 × 5
Distinct prime factors (3)
2, 3, 5
Number of divisors τ(n)(3 + 1)(2 + 1)(1 + 1)
24
Sum of divisors σ(n)
1170
Euler’s totient φ(n)How many of 1 to 360 share no factor with it
96
Perfect square?
No
Perfect cube?
No
Simplified square rootTake one prime out of the root for each pair of equal primes.
√360 = 6√10
Perfect, abundant or deficient?
Abundant: proper divisors add up to 810

360 = 2³ × 3² × 5. It has 24 positive divisors, which add up to 1170.

All 24 positive divisors of 360, in pairs d × (360 ÷ d)
d360 ÷ d
1360
2180
3120
490
572
660
845
940
1036
1230
1524
1820
Step-by-step working (7 steps)
  1. Divide by 2 (3 times)

    360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45. 45 is not divisible by 2, so move on to the next prime.

    360=23⋅45360 = 2^{3} \cdot 45
  2. Divide by 3 (2 times)

    45 ÷ 3 = 15, 15 ÷ 3 = 5. 5 is not divisible by 3, so move on to the next prime.

    45=32⋅545 = 3^{2} \cdot 5
  3. Divide by 5

    5 ÷ 5 = 1. The quotient is 1, so the factorization is complete.

  4. Draw the factor tree

    Split each composite number into a prime and what is left: 360 = 2 × 180, 180 = 2 × 90, 90 = 2 × 45, 45 = 3 × 15, 15 = 3 × 5. The circled leaves 2, 2, 2, 3, 3 and 5 are the prime factors.

  5. Write the result in exponent form

    Group equal primes with exponents, in increasing order.

    360=23⋅32⋅5360 = 2^{3} \cdot 3^{2} \cdot 5
  6. Count the divisors

    Each divisor picks an exponent from 0 up to e for every prime, so multiply (e + 1) over all primes.

    τ(360)=(3+1)(2+1)(1+1)=24\tau(360) = (3 + 1)(2 + 1)(1 + 1) = 24
  7. Add the divisors

    The sum of divisors multiplies the geometric series 1 + p + p² + … + pᵉ for each prime.

    σ(360)=24−12−1⋅33−13−1⋅52−15−1=15⋅13⋅6=1170\sigma(360) = \frac{2^{4} - 1}{2 - 1} \cdot \frac{3^{3} - 1}{3 - 1} \cdot \frac{5^{2} - 1}{5 - 1} = 15 \cdot 13 \cdot 6 = 1170

The calculator shows every division step and a factor tree, then counts, adds and lists all the divisors. It handles numbers up to 40 digits.

By Hira Noor, mathematicianLast reviewed Free, no sign-up, runs in your browserReport a problem

How to use this calculator

  1. Type a whole number with up to 40 digits, for example 72, 360 or 18446744073709551617. Commas between groups of three digits are accepted.
  2. For a negative number, type the minus sign: −84 is factored as −1 × 2² × 3 × 7.
  3. Read the prime factorization at the top in exponent form, then the expanded form, the factor tree, the number of divisors and their sum.
  4. Open the steps to see each division. For large numbers, the steps describe how each prime factor was found instead.

Formulas

Fundamental theorem of arithmetic

n=p1e1⋅p2e2⋯pkekn = p_1^{e_1} \cdot p_2^{e_2} \cdots p_k^{e_k}

Plain-text formula: n = p_1^e_1 · p_2^e_2⋯p_k^e_k

pip_i
distinct primes, p1<p2<⋯<pkp_1 < p_2 < \cdots < p_k
eie_i
the exponent: how many times pip_i divides nn

Every integer greater than 1 is a product of primes in exactly one way, apart from the order of the factors. The calculator lists the primes in increasing order.

Number of divisors

τ(n)=(e1+1)(e2+1)⋯(ek+1)\tau(n) = (e_1 + 1)(e_2 + 1)\cdots(e_k + 1)

Plain-text formula: τ(n) = (e_1 + 1)(e_2 + 1)⋯(e_k + 1)

A divisor of n takes each prime with an exponent from 0 to eie_i, giving ei+1e_i + 1 choices per prime.

Sum of divisors

σ(n)=∏i=1kpiei+1−1pi−1\sigma(n) = \prod_{i=1}^{k} \frac{p_i^{e_i + 1} - 1}{p_i - 1}

Plain-text formula: σ(n) = ∏_{i = 1}^k (p_i^(e_i + 1) − 1)/(p_i − 1)

Each factor is the geometric series 1+pi+pi2+⋯+piei1 + p_i + p_i^2 + \cdots + p_i^{e_i}. Subtract n to get the sum of the proper divisors.

Euler’s totient

φ(n)=n∏i=1k(1−1pi)\varphi(n) = n \prod_{i=1}^{k} \left(1 - \frac{1}{p_i}\right)

Plain-text formula: φ(n) = n∏_{i = 1}^k (1 − 1/p_i)

The count of integers from 1 to n that share no prime factor with n.

Reading the result

The exponent form is the standard answer: 1764=22⋅32⋅721764 = 2^2 \cdot 3^2 \cdot 7^2. The exponents carry most of the information. A number is a perfect square exactly when every exponent is even, and a perfect cube when every exponent is a multiple of 3.

If the number is prime, its factorization is the number itself, and it has exactly two positive divisors. The divisor table pairs each divisor d with n ÷ d, so you only need to search up to √n to find every factor.

For numbers with very large prime factors, the calculator may stop after about one second. It then shows the primes it found and the composite part it could not split, clearly marked. Everything shown is still correct; it is only incomplete.

What is prime factorization?

Prime factorization means writing a whole number as a product of prime numbers. A prime is a whole number greater than 1 whose only positive divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. A number greater than 1 that is not prime is composite, and every composite number breaks down into primes.

For example, 12=2⋅2⋅3=22⋅312 = 2 \cdot 2 \cdot 3 = 2^2 \cdot 3 and 36=22⋅3236 = 2^2 \cdot 3^2. The fundamental theorem of arithmetic says this product is unique: apart from the order of the factors, no other set of primes multiplies to 12. That is why the prime factorization works like a fingerprint for a number.

How to find the prime factorization of a number

Division method. Divide by the smallest prime that goes in evenly, and repeat with the quotient. Use 2 while the number is even, then 3, 5, 7 and so on, until the quotient is 1. The primes you divided by are the prime factors. For 72: 72 ÷ 2 = 36, 36 ÷ 2 = 18, 18 ÷ 2 = 9, 9 ÷ 3 = 3, 3 ÷ 3 = 1, so 72=23⋅3272 = 2^3 \cdot 3^2.

Factor tree method. Write the number at the top and split it into any two factors, such as 72 = 8 × 9. Keep splitting each composite branch (8 = 2 × 4, 4 = 2 × 2, 9 = 3 × 3) until every branch ends in a prime. Circle the primes at the ends of the branches: 2, 2, 2, 3, 3. Different first splits give different trees, but the circled primes are always the same.

Shortcuts. A number is divisible by 2 if its last digit is even, by 3 if its digit sum is divisible by 3, and by 5 if it ends in 0 or 5. You only need to test primes up to the square root: if no prime up to √n divides n, then n itself is prime. For 91, test 2, 3, 5 and 7 (√91 ≈ 9.5); 7 works, so 91 = 7 × 13.

Prime factorization of common numbers

These are the factorizations people look up most often. Enter any other number in the calculator above for its steps, factor tree and divisors.

Prime factorizations of common numbers, with the number of divisors
NumberPrime factorizationExpanded formDivisors
122² × 32 × 2 × 36
182 × 3²2 × 3 × 36
242³ × 32 × 2 × 2 × 38
302 × 3 × 52 × 3 × 58
362² × 3²2 × 2 × 3 × 39
422 × 3 × 72 × 3 × 78
482⁴ × 32 × 2 × 2 × 2 × 310
502 × 5²2 × 5 × 56
602² × 3 × 52 × 2 × 3 × 512
722³ × 3²2 × 2 × 2 × 3 × 312
842² × 3 × 72 × 2 × 3 × 712
902 × 3² × 52 × 3 × 3 × 512
1002² × 5²2 × 2 × 5 × 59
1202³ × 3 × 52 × 2 × 2 × 3 × 516
1442⁴ × 3²2 × 2 × 2 × 2 × 3 × 315
1802² × 3² × 52 × 2 × 3 × 3 × 518
10002³ × 5³2 × 2 × 2 × 5 × 5 × 516

What prime factorization is used for

Greatest common divisor and least common multiple. Write both numbers in prime form. The GCD takes the smaller exponent of each shared prime, and the LCM takes the larger exponent of every prime. For 72=23⋅3272 = 2^3 \cdot 3^2 and 120=23⋅3⋅5120 = 2^3 \cdot 3 \cdot 5, the GCD is 23⋅3=242^3 \cdot 3 = 24 and the LCM is 23⋅32⋅5=3602^3 \cdot 3^2 \cdot 5 = 360. The GCD and LCM calculator does this for up to 10 numbers.

Simplifying square roots. Each pair of equal primes comes out of the root as one prime: 72=22⋅2⋅32=2⋅32=62\sqrt{72} = \sqrt{2^2 \cdot 2 \cdot 3^2} = 2 \cdot 3\sqrt{2} = 6\sqrt{2}. The calculator shows this simplified root for every number that is not a perfect square.

Reducing fractions. Cancel the primes the numerator and denominator share: 84120=22⋅3⋅723⋅3⋅5=710\frac{84}{120} = \frac{2^2 \cdot 3 \cdot 7}{2^3 \cdot 3 \cdot 5} = \frac{7}{10}.

How the calculator factors large numbers

Small primes are removed first by trial division by every prime below 65,536. Whatever remains is tested with the Miller–Rabin test. If it is composite, Pollard’s rho method (in Brent’s faster form) looks for a factor by iterating x→x2+cx \to x^2 + c modulo n and taking greatest common divisors. Each split piece is tested again until only primes remain.

Rho needs about p\sqrt{p} steps to find a prime factor p. A 10-digit factor takes around 100,000 steps and appears almost instantly. A 20-digit factor would take billions of steps, so a product of two 20-digit primes, like the numbers used in cryptography, cannot be split here. That difficulty is exactly what keeps RSA encryption secure.

Worked example

Factor 1260

Write 1260 as a product of primes, then find how many divisors it has and their sum.

  1. Divide by 2 while you can: 1260 ÷ 2 = 630, 630 ÷ 2 = 315. 315 is odd.
  2. Divide by 3: 315 ÷ 3 = 105, 105 ÷ 3 = 35. 35 is not divisible by 3.
  3. Divide by 5: 35 ÷ 5 = 7. The quotient 7 is prime, and 7 ÷ 7 = 1.
  4. Exponent form: 1260=22⋅32⋅5⋅71260 = 2^2 \cdot 3^2 \cdot 5 \cdot 7.
  5. Divisors: τ=(2+1)(2+1)(1+1)(1+1)=36\tau = (2+1)(2+1)(1+1)(1+1) = 36.
  6. Sum: σ=7⋅13⋅6⋅8=4368\sigma = 7 \cdot 13 \cdot 6 \cdot 8 = 4368, because 1+2+4=71 + 2 + 4 = 7, 1+3+9=131 + 3 + 9 = 13, 1+5=61 + 5 = 6 and 1+7=81 + 7 = 8.

Answer: 1260=22⋅32⋅5⋅71260 = 2^2 \cdot 3^2 \cdot 5 \cdot 7, with 36 divisors that add up to 4368. The proper divisors sum to 3108, more than 1260, so 1260 is an abundant number.

Frequently asked questions

How do you find the prime factorization of a number?

Divide the number by the smallest prime that divides it evenly, then repeat with the quotient until you reach 1. For 36: 36 ÷ 2 = 18, 18 ÷ 2 = 9, 9 ÷ 3 = 3, 3 ÷ 3 = 1, so 36=22⋅3236 = 2^2 \cdot 3^2. A factor tree gives the same primes.

Is a factor tree the same as prime factorization?

A factor tree is one way to find the prime factorization. You split the number into two factors, keep splitting the composite ones, and the primes at the ends of the branches are the prime factorization. The calculator draws one for numbers up to 12 digits with at most 10 prime factors, counting repeats.

What is the fastest way to find prime factors?

By hand, use divisibility rules to remove 2, 3 and 5 quickly, then test the primes 7, 11, 13 and so on only up to the square root of what is left. If nothing divides it by then, the remaining number is prime.

How do I get the prime factorization on a calculator?

Some scientific calculators have a factor key. On the Casio fx-991EX, for example, enter the number, press =, then SHIFT and FACT. It handles whole numbers up to 10 digits and shows any part it cannot split in parentheses. This calculator handles up to 40 digits and shows the steps.

What are the prime numbers up to 100?

There are 25: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. Every prime factor of a number up to 10,000 is either one of these or the number left over after dividing them all out. The prime number checker tests any single number.

Is 1 a prime number?

No. A prime has exactly two positive divisors, 1 and itself, and 1 has only one. If 1 counted as prime, factorizations would not be unique, since you could multiply by 1 as often as you like.

Why is every prime factorization unique?

This is the fundamental theorem of arithmetic. It follows from Euclid’s lemma: if a prime divides a product, it divides one of the factors. So two different factorizations of the same number cannot exist.

How do I find the number of divisors from the prime factorization?

Add 1 to each exponent and multiply. For 360=23⋅32⋅5360 = 2^3 \cdot 3^2 \cdot 5 that is (3+1)(2+1)(1+1)=24(3+1)(2+1)(1+1) = 24 divisors.

What is the difference between factors and prime factors?

Factors (divisors) are all numbers that divide n evenly; 12 has six of them: 1, 2, 3, 4, 6 and 12. Prime factors are only the primes among them, here 2 and 3, and the prime factorization 12=22⋅312 = 2^2 \cdot 3 builds every other factor.

What is the prime factorization of a negative number?

Factor out −1 and factor the absolute value: −84 = −1 × 2² × 3 × 7. Strictly, −1 is a unit rather than a prime, so it is written separately.

How large a number can I factor?

You can enter up to 40 digits. Numbers whose prime factors are small, or that have at most one large prime factor, factor instantly. If two or more prime factors each have more than about 12 digits, the calculator may stop after about one second and tell you which part is left unsplit.

LCM and GCF Calculator

LCM and GCF of up to 10 numbers with steps: multiples, prime factors, Euclid’s algorithm and a coprime check.

Number Theory & Bases

Factoring Calculator

Factor a polynomial completely, with each step labeled by method and a check by expanding.

Algebra & Equations

Square Root Calculator

Square, cube and nth roots in simplest radical form, with decimals and prime-factor steps.

Arithmetic & Numbers

Mod Calculator

a mod n with steps, negative numbers, power mod and modular inverses.

Number Theory & Bases

Factorial Calculator

Exact n! with steps and every digit, plus digit count, trailing zeros, n!! and Stirling’s approximation.

Number Theory & Bases

Sources and further reading

  1. Prime Factorization and the Least Common Multiple (Section 2.5, Prealgebra 2e) (opens in a new tab), OpenStax, Rice University
  2. An Introduction to the Theory of Numbers (G. H. Hardy and E. M. Wright, 6th ed.), Oxford University Press
  3. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms (D. E. Knuth, 3rd ed.), Section 4.5.4, Factoring into Primes, Addison-Wesley
  4. An improved Monte Carlo factorization algorithm (R. P. Brent, BIT 20, 1980), Springer

Results are calculated in your browser with methods checked by automated tests, and are intended for learning and general use. For engineering, medical, financial, legal or safety-critical decisions, verify important values independently and follow the rounding rules your work requires. How accurate are these results?