Skip to content

Prime Factorization Calculator

Type a whole number to split it into primes, find out whether it is prime, and see the factor tree, every divisor and the nearest primes. The root calculator also factors numbers, but only to simplify radicals; this page is about the factors themselves, and it works exactly up to 10¹⁸.

Any whole number from −10¹⁸ to 10¹⁸ (up to 19 digits). Separators such as 1,000,000 are fine.

Result

Prime factorization of 360

2³ × 3² × 5

360 is a composite number with 24 divisors.

Written out
2 × 2 × 2 × 3 × 3 × 5
Number of divisors of 360
24
Sum of divisors of 360
1,170
Largest prime below 360
359
Smallest prime above 360
367
Show the working
  1. Divide by 2 as long as it goes evenly360 ÷ 2 ÷ 2 ÷ 2 = 45
  2. Divide by 3 as long as it goes evenly45 ÷ 3 ÷ 3 = 5
  3. No prime up to √5 ≈ 2.24 divides 5 (tried 2)5 = prime
  4. Collect the primes with exponents2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5

Factor tree

Each row splits off the smallest prime factor. The circled numbers are the primes.

  1. 360 = 2 × 180
  2. 180 = 2 × 90
  3. 90 = 2 × 45
  4. 45 = 3 × 15
  5. 15 = 3 × 5

Divisors

All 24 positive divisors of 360.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 8
  • 9
  • 10
  • 12
  • 15
  • 18
  • 20
  • 24
  • 30
  • 36
  • 40
  • 45
  • 60
  • 72
  • 90
  • 120
  • 180
  • 360

How the prime factorization calculator works

A prime is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13, … Every whole number from 2 up can be written as a product of primes in exactly one way, apart from the order of the factors. That product is its prime factorization. Enter a number and you get:

  • the factorization in exponent form, such as 360 = 2³ × 3² × 5, and written out in full;
  • whether the number is prime or composite (and why 0, 1 and negative numbers are neither);
  • a factor tree that splits off the smallest prime at each step;
  • how many divisors the number has, what they add up to, and the divisors themselves;
  • the nearest primes below and above it;
  • the working: which primes were divided out and how the last factor was shown to be prime.

Prime factors are the starting point for the greatest common factor and least common multiple (see the GCF and LCM calculator), for reducing fractions with the fraction calculator, and for simplifying radicals with the root calculator.

Trial division and the divisor formulas

Trial division. Divide by 2 as many times as it goes evenly, then by 3, then 5, 7, 11 and so on through the primes. You can stop as soon as the next prime squared is bigger than what is left: a number with no prime factor up to its square root is itself prime. That is why checking 97 only needs 2, 3, 5 and 7, since √97 ≈ 9.85.

Large numbers. Trial division up to the square root of an 18-digit number would take about a billion divisions, so above 10,000 the calculator switches methods. The Miller–Rabin test decides whether a number is prime; with the twelve bases 2 to 37 it gives no wrong answers below about 3.3 × 10²⁴ (Sorenson and Webster), far above this calculator's limit. Pollard's rho method then finds a factor of any composite that is left. All arithmetic is exact whole-number arithmetic, not floating point.

Divisors. If n = p₁^a₁ × p₂^a₂ × … × pₖ^aₖ, every divisor picks an exponent from 0 to a for each prime. That gives the count and the sum directly:

d(n) = (a₁ + 1) × (a₂ + 1) × … × (aₖ + 1)

σ(n) = (p₁^(a₁+1) − 1) ÷ (p₁ − 1) × … × (pₖ^(aₖ+1) − 1) ÷ (pₖ − 1)

p₁ … pₖ
the different primes in the factorization
a₁ … aₖ
how many times each prime appears (its exponent)

Worked example: 360

  1. Divide by 2 while it goes evenly: 360 ÷ 2 ÷ 2 ÷ 2 = 45. That is three 2s.
  2. 45 is odd, so try 3: 45 ÷ 3 ÷ 3 = 5. That is two 3s.
  3. 5 is prime (no prime up to √5 ≈ 2.24 divides it), so it is the last factor.
  4. Collect them: 360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5.
  5. Number of divisors: (3 + 1) × (2 + 1) × (1 + 1) = 4 × 3 × 2 = 24.
  6. Sum of divisors: (2⁴ − 1) ÷ 1 × (3³ − 1) ÷ 2 × (5² − 1) ÷ 4 = 15 × 13 × 6 = 1,170.
  7. Nearest primes: 361 = 19², 363 = 3 × 11² and 365 = 5 × 73 are composite, so the primes on either side are 359 and 367.

A prime. For 97, none of 2, 3, 5 or 7 divides it and 11² = 121 is already bigger than 97, so 97 is prime. It has two divisors, 1 and 97, and the nearest primes are 89 and 101.

A hard one. 999,999,866,000,004,473 has no prime factor below 10,000. Pollard's rho splits it into 999,999,929 × 999,999,937, two nine-digit primes, in a few milliseconds.

0, 1 and negative numbers

  • 1 is not prime. If it were, factorizations would stop being unique (6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3 …). Its factorization is the empty product, and its only divisor is 1.
  • 0 has no factorization. Every whole number divides 0 (0 = 0 × k), so it has infinitely many divisors and is neither prime nor composite. The smallest prime above it is 2.
  • Negative numbers are not called prime or composite. The usual convention writes the sign as a factor of −1 and factors the absolute value: −360 = −1 × 2³ × 3² × 5. Divisor counts and nearest primes refer to the absolute value.
  • 2 is the only even prime. Every other even number has 2 as a factor, which is why trial division starts there and then only tries odd numbers.

Limits

The calculator accepts whole numbers from −10¹⁸ to 10¹⁸. Above that, a number made of two large primes can take seconds to split in a browser, so it is not offered. Numbers with many divisors show the smallest 120 of them; the rest are those numbers' partners (n ÷ d). The written-out form is left out when a number has more than 24 prime factors. For decimals or fractions, factor the numerator and denominator separately.

Frequently asked questions

How do I know if a number is prime?

Try dividing it by every prime up to its square root. If none of them goes in evenly, the number is prime. For 97 that means trying 2, 3, 5 and 7, since 11² = 121 is already larger than 97. None of them divides 97, so it is prime.

Is 1 a prime number?

No. A prime must have exactly two different divisors, 1 and itself, and 1 has only one. Excluding 1 is what keeps prime factorizations unique; otherwise you could add any number of 1s to a product.

What is a factor tree?

A diagram that splits a number into two factors, then splits those again, until only primes are left. Whichever split you start with, the primes at the ends of the branches are always the same. Here each step splits off the smallest prime, for example 360 = 2 × 180, then 180 = 2 × 90.

How many divisors does a number have?

Add 1 to each exponent in the prime factorization and multiply the results. 360 = 2³ × 3² × 5, so it has (3 + 1) × (2 + 1) × (1 + 1) = 24 divisors. A prime always has exactly 2.

What is the difference between factors and prime factors?

Factors (divisors) are all the whole numbers that divide a number evenly: 12 has 1, 2, 3, 4, 6 and 12. Prime factors are only the primes among them, repeated as often as they divide: 12 = 2 × 2 × 3.

Sources

Last reviewed September 19, 2026