Prime Factorization Calculator

Prime Factorization

2^3 × 3^2 × 5

The Numbers

  • Distinct prime factors: 3
  • Total prime factors (with repetition): 6

Analysis

  • 360 is a composite number.

Compare Calculations

Downloads

Includes your inputs and results for this calculation, plus any additional calculations you've compared.

How This Calculator Works

Every whole number greater than 1 can be broken down into a unique set of prime numbers multiplied together — its prime factorization. Enter a whole number, and this calculator finds that factorization instantly, along with whether the number itself is prime.

The Formula

The Fundamental Theorem of Arithmetic guarantees every whole number N greater than 1 has exactly one prime factorization, up to the order the factors are written in:

N=p1a1×p2a2××pkak\vA{N} = \vB{p_1}^{\vC{a_1}} \times \vB{p_2}^{\vC{a_2}} \times \cdots \times \vB{p_k}^{\vC{a_k}}

where each pi\vB{p_i} is a distinct prime number and each ai\vC{a_i} is how many times that prime divides evenly into N.

This calculator finds that factorization using trial division: starting at 2, it repeatedly checks whether each number divides evenly into what’s left, dividing it out (and counting how many times) whenever it does, then moving to the next candidate. Once a candidate’s square exceeds what remains, anything still left over must itself be prime — any smaller factor would already have been found:

if d2>remaining value, then remaining value is prime\text{if } \vD{d}^2 > \vE{\text{remaining value}}, \text{ then } \vE{\text{remaining value}} \text{ is prime}

Worked Example

Finding the prime factorization of 360:

  1. 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45 (2 divides in 3 times; 45 is odd, so move on).
  2. 45 ÷ 3 = 15, ÷ 3 = 5 (3 divides in 2 times; 5 isn’t divisible by 3 again).
  3. 5 remains, and no further divisor’s square is ≤ 5, so 5 itself is prime.
  4. Result: 2³ × 3² × 5.

Source: Trial Division.

Frequently Asked Questions

What is prime factorization?

Prime factorization breaks a whole number down into the prime numbers that multiply together to make it — every whole number greater than 1 has exactly one such breakdown (the "fundamental theorem of arithmetic"). For example, 12 = 2 × 2 × 3.

How do I know if a number is prime?

A prime number has no factors other than 1 and itself. This calculator's factorization will show just that one number (with no other factors) whenever the number you entered is prime — the Analysis section states this directly.

Is there a limit to how large a number I can factor?

This calculator uses trial division, which works well for the range of numbers a typical calculator use case involves, but becomes slow for extremely large numbers (the kind used in cryptography), which need much more sophisticated algorithms.