Why does a full turn have 360 degrees? Astronomy and the Babylonian base-60 system are part of the story, but arithmetic explains why the convention stuck. The prime factorization of 360 is , and from those exponents alone you can read off that 360 has divisors. No smaller positive integer has that many. A circle of 360 degrees can be cut into halves, thirds, quarters, fifths, sixths, eighths, ninths, tenths, twelfths and more, every one a whole number of degrees. A metric circle of 100 units could not even be split into thirds.
That is what prime factorization is for. It writes a whole number greater than 1 as a product of primes, the multiplicative atoms that cannot be split further, and the result is unique apart from the order you write the factors in. To find it, divide by the smallest prime that goes in, record it, and repeat on the quotient until only a prime is left. Once you have the factorization, divisor counts, greatest common factors, least common multiples, simplified fractions and simplified square roots all follow by reading exponents.
What is prime factorization, exactly?
A prime is an integer whose only positive divisors are and . The first few are . Every integer can be written as
where the are primes and the exponents are positive integers. This is the canonical form of the prime factorization. A few examples:
A prime is its own factorization: . The number 1 has the empty factorization, with no primes at all, which is one reason it is not counted as a prime. The article on why 1 is not a prime number explains how including it would wreck uniqueness.
The guarantee that this representation always exists and is always the same is called the fundamental theorem of arithmetic. Existence is easy: if is not prime, it splits as with both factors smaller, and you keep splitting until every piece is prime. The process must stop because the pieces keep shrinking. Uniqueness is harder, and we will come back to it.
What is a factor tree?
A factor tree is the most visual way to find a prime factorization. Write the number at the top. Split it into any two factors whose product is the number, draw a branch to each, and keep splitting every composite factor. When a branch reaches a prime, it stops. The primes at the ends of the branches, the leaves, are the prime factorization.
The useful thing about a factor tree is that you can start anywhere. For 360 you might notice it is even and start with , or you might see straight away. The trees look completely different, yet the leaves agree.
Two factor trees for 360. The left one peels off a 2 at every step it can; the right one starts from 12 × 30. The shapes differ, but both end in the same six prime leaves, 2, 2, 2, 3, 3 and 5, so both give 360 = 2³ × 3² × 5.
Collect the leaves, sort them, and group repeated primes into powers:
Always check by multiplying back: and . The fact that two very different trees always give the same multiset of leaves is not a coincidence of this example. It is the uniqueness half of the fundamental theorem, and it is why a factor tree is a legitimate method rather than a lucky one.
Factor trees work best for numbers with obvious factors, such as those ending in 0 or 5, or even numbers. For a number like 1,001 you have no obvious first split, and a more systematic method is better.
How do you find the prime factorization of a number?
The systematic method is repeated division, often written as a ladder. Divide by the smallest prime that goes in evenly, write the quotient below, and repeat. When the quotient is prime, stop. Here is 1,260:
In words: 1,260 is even, so divide by 2 to get 630; still even, so divide by 2 again to get 315; 315 is odd but its digit sum is 9, so divide by 3 to get 105, and by 3 again to get 35; 35 ends in 5, so divide by 5 to get 7, which is prime. On paper this is usually drawn as a ladder, with each prime divisor written to the left of the number it divides and the quotient written underneath. The divisors used along the way, together with the final 7, are the prime factors:
Because you always try the smallest prime first, the factors come out already sorted, and you never accidentally divide by a composite number: by the time you reach 9, say, all factors of 3 have already been removed.
To decide quickly which small prime divides a number, use the standard divisibility tests. Each one has a short reason behind it.
- Divisible by 2 if the last digit is even. Every number is where is the last digit, and , so exactly when .
- Divisible by 5 if the last digit is 0 or 5. Same reason: .
- Divisible by 3 if the digit sum is divisible by 3. Since , every power , so a number is congruent to the sum of its digits modulo 3. For 1,260 the digit sum is .
- Divisible by 9 if the digit sum is divisible by 9, for the identical reason, since as well. So 1,260 is divisible by 9, which matches the in its factorization.
- Divisible by 11 if the alternating digit sum, starting from the units digit, is divisible by 11. Here , so . For 4,147 the alternating sum is , so ; indeed .
The reasoning in the last three bullets is modular arithmetic in its most practical form. For 7 and 13 there are tests too, but at that point direct division is usually just as fast.
Prime factorization of common numbers: a reference table
These are the factorizations people search for most often, together with the number of divisors , which the next sections show how to compute from the exponents.
| Number | Prime factorization | Number of divisors |
|---|---|---|
| 12 | 6 | |
| 18 | 6 | |
| 24 | 8 | |
| 36 | 9 | |
| 48 | 10 | |
| 60 | 12 | |
| 72 | 12 | |
| 84 | 12 | |
| 90 | 12 | |
| 100 | 9 | |
| 120 | 16 | |
| 144 | 15 | |
| 180 | 18 | |
| 360 | 24 | |
| 1000 | 16 |
Two patterns are worth noticing. Perfect squares such as 36, 100 and 144 have only even exponents, and they are exactly the numbers in the table with an odd number of divisors. And the numbers with the most divisors for their size, like 60, 120 and 360, use small primes with exponents that decrease as the primes grow.
When can you stop dividing? The square root rule
Suppose you are trying to factor and have tested every prime up to some point. When can you stop and declare that what remains is prime? The answer is: once the primes you are testing exceed .
The reason is simple. If with , then , so . Every composite number therefore has a factor no larger than its square root, and hence a prime factor no larger than its square root. If no prime up to divides , then has no factorization into smaller pieces at all, and it is prime.
Take 97. Since and , we have , so the only primes to try are 2, 3, 5 and 7.
- 97 is odd, so .
- Its digit sum is 16, so .
- It does not end in 0 or 5, so .
- and , so and .
Four checks, and 97 is proved prime. Without the square root rule you would have tested every prime up to 96.
The same rule speeds up factoring in the middle of a ladder. After removing the small primes from a number, you only need to keep testing up to the square root of the current quotient, which shrinks as you go. This approach, trying candidate divisors in order, is called trial division. It is perfectly fine for numbers with a dozen digits, because their square roots have only six. It is hopeless for numbers with hundreds of digits, which is the subject of a later section.
How do you use prime factorization to find the GCF and LCM?
The greatest common factor (GCF, also called the greatest common divisor or gcd) of two numbers is the largest number dividing both. The least common multiple (LCM) is the smallest positive number both divide. With prime factorizations in hand, both come down to comparing exponents.
A number divides exactly when every prime appears in with an exponent no larger than its exponent in . So the largest common divisor takes each prime to the smaller of its two exponents, and the smallest common multiple takes each prime to the larger. Writing and , with exponent 0 for primes that do not appear,
Worked example: 360 and 1,260. Line the exponents up prime by prime:
| Prime | Exponent in 360 | Exponent in 1260 | Min (for GCF) | Max (for LCM) |
|---|---|---|---|---|
| 2 | 3 | 2 | 2 | 3 |
| 3 | 2 | 2 | 2 | 2 |
| 5 | 1 | 1 | 1 | 1 |
| 7 | 0 | 1 | 0 | 1 |
Therefore
Since for any two numbers, multiplying the GCF by the LCM adds the exponents back together, which gives the identity
Check: . The identity also means that once you know one of the two, the other costs a single division. As a bonus, 2520 is the least common multiple of all the numbers from 1 to 10.
A second example: 84 and 90. From the table, and . The common primes are 2 and 3, each with minimum exponent 1, so . The LCM takes , , and , giving . Indeed .
The faster route for the GCF. For large numbers, factoring first is the slow way. The Euclidean algorithm finds the gcd by repeated division with remainder, never factoring anything:
so in two steps. The number of steps grows only with the number of digits, so computers routinely find the gcd of two numbers with hundreds of digits in a fraction of a millisecond, even though factoring either number could be far out of reach. The prime factorization method is best when you already have the factorizations, or when the numbers are small enough to factor in your head; it also shows why the answer is what it is.
What else can prime factorization tell you?
The number of divisors. Every divisor of has the form with . There are choices for each exponent, and by uniqueness different choices give different divisors, so
For this gives , the count from the opening.
The sum of divisors. Expanding the product produces every divisor exactly once, and summing each geometric series gives
For 360: . This function is the one behind perfect numbers, those with .
Highly composite numbers. A positive integer is highly composite if it has more divisors than every smaller positive integer. Ramanujan named and studied them in a long paper of 1915. The sequence begins
and 360 sits in it: with 24 divisors it beats every number below it. So does , which has divisors. That number is , and Plato chose it as the ideal number of households for the city in his Laws, precisely because it can be divided in so many ways. The pattern in the factorizations is visible: highly composite numbers use an unbroken run of the smallest primes with non-increasing exponents.
Simplifying fractions. To reduce a fraction, factor top and bottom and cancel common primes:
What you cancelled was , the GCF, so this is the same calculation as before in different clothing.
Simplifying square roots. A square root simplifies by pulling out pairs of equal primes:
The same logic shows that is a whole number exactly when every exponent in the factorization of is even, and in fact that is irrational: if then , but the exponent of 2 is even on the left and odd on the right, which uniqueness forbids.
Why is prime factorization unique? The fundamental theorem of arithmetic
The fundamental theorem of arithmetic states that every integer greater than 1 can be written as a product of primes, and that this product is unique up to the order of the factors.
Uniqueness can feel too obvious to need proof. It is not. The key ingredient is Euclid’s lemma: if a prime divides a product , then or . That property is what separates primes from composites; for instance but 6 divides neither 4 nor 9. Euclid’s lemma itself is usually proved via Bézout’s identity, which comes out of the Euclidean algorithm.
With the lemma, uniqueness follows quickly. Suppose are two prime factorizations of the same number. Then divides the right-hand product, so by repeated use of Euclid’s lemma it divides some , and since is prime, . Cancel it from both sides and repeat. The primes pair off one by one, so the two lists are the same.
To see that something real is being proved, step outside the ordinary integers. In the number system , made of all numbers with and integers,
and none of these four factors can be split further within that system. Six has two genuinely different factorizations into unsplittable pieces. Euclid’s lemma fails there: 2 divides the product but neither factor. Repairing this breakdown is what led to ideals and the whole field of algebraic number theory. In the ordinary integers the lemma holds, and with it the uniqueness that factor trees silently rely on.
Why is factoring large numbers so hard, and why does it matter?
Multiplying two primes is easy. Even two 300-digit primes can be multiplied by a computer almost instantly. Going backwards, from the product to the two primes, is believed to be extremely hard. Trial division on a 600-digit number would need to test candidates up to a 300-digit square root, a count far beyond the number of atoms in the observable universe.
Better algorithms exist. The best known general-purpose method, the general number field sieve, has a heuristic running time of roughly
which is faster than any power of but still grows faster than any power of the number of digits. In February 2020 a team of six researchers, Boudot, Gaudry, Guillevic, Heninger, Thomé and Zimmermann, factored RSA-250, a 250-digit, 829-bit challenge number, using the open-source CADO-NFS software. The computation took about 2,700 core-years of computing time.
This asymmetry is the foundation of RSA encryption. An RSA public key contains a modulus , the product of two large secret primes. Anyone can encrypt with , but decrypting requires knowing and , and current keys use moduli of 2048 bits or more, well beyond the RSA-250 record. If someone could compute prime factorizations of numbers that size quickly, a large part of internet security would collapse. The wider story is told in how prime numbers secure the internet.
There is one known way to factor quickly, in principle. In 1994 Peter Shor showed that a sufficiently large quantum computer could factor in time polynomial in the number of digits, by turning factoring into the problem of finding the period of the function . The details are in the article on Shor’s algorithm. Quantum hardware so far has factored only toy examples such as 15 and 21 this way, but the threat is serious enough that new post-quantum cryptographic standards are being deployed now.
Where did prime factorization come from?
The ideas are ancient. Book VII of Euclid’s Elements, written around 300 BCE, contains Euclid’s lemma as Proposition VII.30. Propositions VII.31 and VII.32 give the existence half: every composite number is measured by some prime, and so every number is either prime or measured by a prime. Book IX, Proposition 14, comes close to uniqueness: if a number is the least that is measured by certain primes, it is measured by no other prime. Historians note that IX.14 does not cover numbers with repeated prime factors, so it falls short of the full theorem, and Euclid never states the theorem in its modern form. The same book, at IX.20, contains his famous proof that there are infinitely many primes.
The first clear statement and proof of the full fundamental theorem of arithmetic is generally credited to Carl Friedrich Gauss, in Article 16 of his Disquisitiones Arithmeticae of 1801. Gauss proved uniqueness from Euclid’s lemma, much as above, and made unique factorization a central tool rather than something used silently in the background. His later work on the integers now named after him, of the form , showed that unique factorization can be asked about in other number systems too, which opened the line of questions that ended at and ideals.
So the next time you see a 360-degree protractor, a 24-hour day or a 60-minute hour, read the numbers through their factorizations: , , . Each is built from small primes with generous exponents, which is exactly what makes a number easy to share. Prime factorization turns a number into a list of exponents, and that list answers almost every question about divisibility you might want to ask.
Related topics: Why Is 1 Not a Prime Number?, How Does the Euclidean Algorithm Work?, Modular Arithmetic, The Distribution of Primes, Perfect Numbers and Mersenne Primes, Euler’s Totient Function, Algebraic Number Theory, RSA Encryption, How Prime Numbers Secure the Internet, How Does Shor’s Algorithm Work?
Frequently asked
What is prime factorization?
It is the way of writing a whole number greater than 1 as a product of prime numbers, usually grouped into powers in increasing order. For example, 360 is 2 cubed times 3 squared times 5, and 100 is 2 squared times 5 squared. The fundamental theorem of arithmetic guarantees that every such number has exactly one prime factorization, apart from the order of the factors.
How do you find the prime factorization of a number?
Divide by the smallest prime that goes in evenly, write down that prime, and repeat with the quotient until the quotient is itself prime. For 1260 this gives 2, 2, 3, 3, 5 and 7, so 1260 is 2 squared times 3 squared times 5 times 7. You only need to test primes up to the square root of whatever is left; if none divides it, what is left is prime.
What is a factor tree?
A factor tree is a diagram that splits a number into any two factors, then splits each composite factor again, until every branch ends in a prime. The primes at the ends of the branches, multiplied together, give the prime factorization. Different first splits produce differently shaped trees, but the set of prime leaves is always the same.
How do you find the GCF using prime factorization?
Factor both numbers, then take every prime they have in common raised to the smaller of its two exponents. For 360 and 1260, the common primes are 2, 3 and 5 with smaller exponents 2, 2 and 1, so the greatest common factor is 4 times 9 times 5, which is 180. For large numbers the Euclidean algorithm is much faster because it needs no factoring.
How do you find the LCM using prime factorization?
Factor both numbers, then take every prime that appears in either one raised to the larger of its two exponents. For 360 and 1260 that is 2 cubed times 3 squared times 5 times 7, which is 2520. A useful check is that the GCF times the LCM always equals the product of the two numbers: 180 times 2520 equals 360 times 1260.
Why is prime factorization unique?
Because of Euclid's lemma: if a prime divides a product of two numbers, it must divide at least one of them. Given two factorizations of the same number, any prime in the first must divide the second product and therefore equal one of its primes; cancel it and repeat. Uniqueness is a real theorem, not an obvious fact, and in some number systems such as the integers extended by the square root of minus 5 it fails.