Prime Factorization Calculator

Your values

From 2 up to 40 digits

Large numbers use Pollard's rho method; 20-digit numbers usually take a fraction of a second.

Result

Prime factorization of 360

360=23⋅32⋅5360=2^{3}\cdot3^{2}\cdot5
Prime number
No
Distinct prime factors
3
Prime factors counted with repeats
6
Number of divisors
24
Sum of divisors
1,170
Previous prime
359
Next prime
367

Division ladder

DividePrimeQuotient
3602180
180290
90245
45315
1535
551
Show all 24 divisors

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

About this tool

Every whole number greater than 1 is either prime or a product of primes, and that product is unique apart from the order of the factors (the fundamental theorem of arithmetic). Prime factorization is the basis for simplifying fractions, finding the GCD and LCM, simplifying square roots and counting divisors. This calculator factors numbers of up to 40 digits right in your browser with exact arithmetic.

How it works

Enter a whole number of 2 or more. The calculator writes it as a product of primes in exponent form, such as 360=23⋅32⋅5360=2^{3}\cdot3^{2}\cdot5, and shows the division ladder: divide by the smallest prime factor again and again until 1 is left.

You also get the number of divisors and their sum, the full list of divisors when there are at most 1,000, whether the number is prime, and the nearest primes below and above it. Thousands separators such as 1,001 are fine.

n=p1a1 p2a2⋯pkakd(n)=(a1+1)(a2+1)⋯(ak+1)\begin{gathered}n=p_1^{a_1}\,p_2^{a_2}\cdots p_k^{a_k}\\[0.6em]d(n)=(a_1+1)(a_2+1)\cdots(a_k+1)\end{gathered}

Example

Factor 360 with a division ladder: 360÷2=180360\div2=180, 180÷2=90180\div2=90, 90÷2=4590\div2=45, 45÷3=1545\div3=15, 15÷3=515\div3=5 and 5 is prime. So 360=23⋅32⋅5360=2^{3}\cdot3^{2}\cdot5. It has (3+1)(2+1)(1+1)=24(3+1)(2+1)(1+1)=24 divisors.

A larger case: 600851475143=71⋅839⋅1471⋅6857600851475143=71\cdot839\cdot1471\cdot6857, whose largest prime factor is 6857.

Prime factorization table

Prime factorizations from 2 to 60

  • 2 = 2
  • 3 = 3
  • 4 = 2²
  • 5 = 5
  • 6 = 2 × 3
  • 7 = 7
  • 8 = 2³
  • 9 = 3²
  • 10 = 2 × 5
  • 11 = 11
  • 12 = 2² × 3
  • 13 = 13
  • 14 = 2 × 7
  • 15 = 3 × 5
  • 16 = 2⁴
  • 17 = 17
  • 18 = 2 × 3²
  • 19 = 19
  • 20 = 2² × 5
  • 21 = 3 × 7
  • 22 = 2 × 11
  • 23 = 23
  • 24 = 2³ × 3
  • 25 = 5²
  • 26 = 2 × 13
  • 27 = 3³
  • 28 = 2² × 7
  • 29 = 29
  • 30 = 2 × 3 × 5
  • 31 = 31
  • 32 = 2⁵
  • 33 = 3 × 11
  • 34 = 2 × 17
  • 35 = 5 × 7
  • 36 = 2² × 3²
  • 37 = 37
  • 38 = 2 × 19
  • 39 = 3 × 13
  • 40 = 2³ × 5
  • 41 = 41
  • 42 = 2 × 3 × 7
  • 43 = 43
  • 44 = 2² × 11
  • 45 = 3² × 5
  • 46 = 2 × 23
  • 47 = 47
  • 48 = 2⁴ × 3
  • 49 = 7²
  • 50 = 2 × 5²
  • 51 = 3 × 17
  • 52 = 2² × 13
  • 53 = 53
  • 54 = 2 × 3³
  • 55 = 5 × 11
  • 56 = 2³ × 7
  • 57 = 3 × 19
  • 58 = 2 × 29
  • 59 = 59
  • 60 = 2² × 3 × 5

The 25 primes below 100

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

A number is prime when its factorization is just itself. To test a number n for prime factors by hand, you only need to try primes up to n\sqrt{n}.

Assumptions and limits

Numbers of up to 40 digits are accepted. Small factors are found by trial division and larger ones with Pollard's rho method, within a fixed amount of work so the page stays responsive. If a number has two very large prime factors (roughly 13 digits or more each), the calculator reports the part it could not split. Primality is proven for numbers below 3.3×10243.3\times10^{24}; larger primes are reported as probable primes after 13 Miller–Rabin tests.

Frequently asked questions

What is prime factorization?

It is writing a number as a product of prime numbers. For example 84=2⋅2⋅3⋅7=22⋅3⋅784=2\cdot2\cdot3\cdot7=2^{2}\cdot3\cdot7. Apart from the order, there is only one way to do it.

How do you make a factor tree?

Split the number into any two factors, then keep splitting each factor that is not prime until only primes remain at the ends of the branches. Whichever split you start with, you end up with the same primes. The division ladder used here is the same idea, always dividing by the smallest prime.

How do I find the number of divisors?

Add 1 to each exponent in the prime factorization and multiply. For 72=23⋅3272=2^{3}\cdot3^{2} that is (3+1)(2+1)=12(3+1)(2+1)=12 divisors.

Is 1 a prime number?

No. A prime has exactly two divisors, 1 and itself, and 1 has only one. Leaving 1 out keeps factorizations unique. 2 is the only even prime.

How does prime factorization help with GCD and LCM?

The GCD takes each common prime with its smaller exponent and the LCM takes every prime with its larger exponent. For 12=22⋅312=2^{2}\cdot3 and 18=2⋅3218=2\cdot3^{2}: the GCD is 2⋅3=62\cdot3=6 and the LCM is 22⋅32=362^{2}\cdot3^{2}=36.

Link with your values

Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.

ParameterValueIf omitted
nWhole numberwhole number of any lengthrequired

Examples

  • ?n=1001
  • ?n=600851475143

Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.

Result elements: [data-result-block="prime_factorization_calculator"]