1001Ferramentas
🧮 Dev

Prime Factorization Generator

Decompose N into prime factors with exponents (e.g., 360 = 2³·3²·5). Useful for LCM, GCD and number theory.

Decomposição:

Lista de fatores:

Prime factorisation with the exponents on show

Every integer greater than 1 can be written in exactly one way as a product of primes — that is the fundamental theorem of arithmetic. 360 is two cubed times three squared times five, and no other combination of primes gives 360. That uniqueness is what makes factorisation more than a curiosity: the greatest common divisor, the least common multiple and the divisor count all fall out of it.

Type the number and the page returns the factorisation with exponents in reduced form. The method is trial division: divide by 2 while it works, then by 3, and so on up to the square root of what remains — whatever is left above that is necessarily prime. It is the simplest algorithm there is and handles everyday numbers comfortably.

The difficulty of factoring large numbers is no accident: it underpins much of the cryptography in use. RSA leans on the gap between multiplying two three-hundred-digit primes, which is instant, and recovering the factors from the product, which no known classical computer does in reasonable time. This page handles numbers up to the trillions; above that, trial division stops being practical and methods like Pollard's rho and the number field sieve take over.

Frequently asked questions

Why is testing up to the square root enough?
Because if a number has a factor larger than its root, it necessarily has the complementary factor below the root — and that one would already have been found. Reaching the root without finding a divisor means what remains can only be prime.
How does it relate to GCD and LCM?
Directly: with both factorisations in hand, the greatest common divisor is the product of the shared primes with the smaller exponent, and the least common multiple is the product of all primes with the larger exponent. It is the school method — though for large numbers Euclid's algorithm is far faster for the GCD.
How do I count divisors from the factorisation?
Add 1 to each exponent and multiply the results. 360, being 2³ × 3² × 5¹, has (3+1)(2+1)(1+1) = 24 divisors. It works because each divisor corresponds to independently choosing the exponent of each prime, from zero up to the maximum.

Related Tools