๐Ÿ” Prime Factorization Calculator

Enter a whole number to check whether it's prime and see its full prime factorization. Uses trial division, so very large numbers (beyond about 10ยนยฒ) may be slow or refused.

Trial division, stopping at the square root

The number is divided by 2, then by every odd number in turn, and each divisor that goes in evenly is pulled out repeatedly before moving on:

while d × d ≤ remaining:
    while remaining mod d = 0:  record d, remaining = remaining / d
    d = next odd number
if remaining > 1:  remaining is itself prime, record it

The default 360 loses three 2s to leave 45, then two 3s to leave 5. At that point 5 × 5 is already past 5, so the loop ends and the leftover 5 is recorded as prime: 2³ × 3² × 5. The card shows six factors counted with repetition and three distinct ones.

Reading the result, and the size limit

Inputs stop at one trillion. A prime that large needs about half a million divisions, fine for a browser, but the method scales badly beyond it - cryptographic numbers are factored differently.

Frequently asked questions

What is the prime factorization of 360?

2^3 x 3^2 x 5, or 2 x 2 x 2 x 3 x 3 x 5 written out. That is six prime factors drawn from three distinct primes.

Is 1 a prime number?

No, and it is not composite either. A prime has exactly two distinct divisors, 1 and itself, and 1 only has one.

How many divisors does 360 have?

24. Take the exponents in 2^3 x 3^2 x 5, add one to each to get 4, 3 and 2, then multiply those together.