Prime Factorization With Factor Trees and Ladders
Break any whole number into primes with factor trees or the ladder method, know when to stop, and use the result in algebra.
Key takeaways
- A prime number is a whole number greater than 1 whose only positive factors are 1 and itself.
- A factor tree may start with any factor pair, and every choice ends in the same collection of primes.
- The ladder method divides by primes in increasing order and reads the factorization down the side.
- To test whether n is prime, you only need to try primes no larger than √n.
- Prime factorization unlocks greatest common factors, least common multiples, radical simplification and divisor counts.
Prime factorization means writing a whole number greater than 1 as a product of prime numbers. For example, 360 = 2 × 2 × 2 × 3 × 3 × 5, or 2³ × 3² × 5 using exponents.
Two methods get you there. A factor tree splits a number into any two factors and keeps splitting. A ladder divides repeatedly by small primes. Both give the same primes in the end, and that guarantee is what makes the result so useful.
Primes, composites and the number 1
A factor of a number divides it with no remainder. A prime has exactly two positive factors, 1 and itself. A composite number has more than two.
The primes begin 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47. The number 2 is the only even prime, since every other even number is divisible by 2.
The number 1 is neither prime nor composite. It has only one positive factor. Leaving it out also keeps factorizations unique: if 1 counted as prime, you could write 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3 and so on without end.
Zero and negative numbers are not given prime factorizations in this sense. For a negative integer, you can factor out -1 and work with what remains: -45 = -1 × 3² × 5.
Building a factor tree
To make a factor tree, write the number at the top. Split it into two factors, each greater than 1. Split any factor that is still composite. Stop each branch when you reach a prime.
Here is 360, written with indentation to show the branches.
360
├─ 36
│ ├─ 4 → 2 × 2
│ └─ 9 → 3 × 3
└─ 10
└─ 2 × 5 Collecting the ends of the branches gives 2, 2, 3, 3, 2, 5. Sorted and written with exponents, 360 = 2³ × 3² × 5.
You could have begun with 8 × 45, 4 × 90 or 12 × 30. Try one: 12 × 30 = (2 × 2 × 3) × (2 × 3 × 5), which again holds three 2s, two 3s and one 5.
Choosing a split near the middle of the factor pairs tends to give shorter, bushier trees. Splitting off a 10 is handy whenever the number ends in 0.
The ladder method
The ladder method, also called repeated division, trades creativity for routine. Divide by the smallest prime that works, write the quotient underneath, and repeat until you reach 1.
2 | 360
2 | 180
2 | 90
3 | 45
3 | 15
5 | 5
1 The divisors down the left side are the prime factors: 2, 2, 2, 3, 3, 5.
Stay with each prime until it no longer divides, then move to the next. Because you work upward, every divisor that succeeds is automatically prime: any composite divisor would have had its smaller prime parts removed already.
Quick tests save time here. A number is divisible by 2 if it is even, by 3 if its digit sum is divisible by 3 and by 5 if it ends in 0 or 5. The reasons are laid out in divisibility rules and their proofs.
Knowing when a number is prime
The hardest moment is a number that resists. Is 97 prime, or have you just missed a factor?
If n is composite, it can be written as a × b with both greater than 1. They cannot both exceed √n, because then their product would exceed n. So a composite number always has a prime factor no larger than √n.
For 97, √97 is a little under 10. Try 2, 3, 5 and 7. None divides evenly, so 97 is prime.
For 221, √221 is between 14 and 15. Try 2, 3, 5, 7, 11 and 13. The last one works: 221 = 13 × 17.
Some composites look prime at a glance. These are worth remembering.
| Number | Factorization |
|---|---|
| 51 | 3 × 17 |
| 57 | 3 × 19 |
| 87 | 3 × 29 |
| 91 | 7 × 13 |
| 119 | 7 × 17 |
| 143 | 11 × 13 |
A larger example
Factor 1,092. It is even, so start the ladder.
1092 ÷ 2 = 546
546 ÷ 2 = 273
273 ÷ 3 = 91 (digit sum of 273 is 12)
91 ÷ 7 = 13
13 is prime
1092 = 2² × 3 × 7 × 13 Check by multiplying: 4 × 3 = 12, 12 × 7 = 84, and 84 × 13 = 1,092.
Always run that check. It takes a few seconds and catches both arithmetic slips and a lost factor. A second check is to scan your list for composites. A 9 or a 15 left in the answer means the job is not finished.
Shortcuts for numbers with structure
You do not always need to peel off primes one at a time. If a number has an obvious structure, use it.
Round numbers split cleanly. Since 10 = 2 × 5, you get 1,000 = 10³ = 2³ × 5³. For 4,200, write 42 × 100, then 42 = 2 × 3 × 7 and 100 = 2² × 5², giving 2³ × 3 × 5² × 7.
Squares let you factor the root and double every exponent. Because 144 = 12² and 12 = 2² × 3, you get 144 = 2⁴ × 3².
Numbers close to a square can yield to the difference of squares pattern, a² - b² = (a - b)(a + b). Take 391. It equals 400 - 9 = 20² - 3², so 391 = 17 × 23. Likewise 899 = 900 - 1 = 29 × 31. Both would take much longer to find by testing primes in order.
Powers of a number work the same way. To factor 18³, factor 18 = 2 × 3² first, then cube it to get 2³ × 3⁶. Multiplying out 5,832 and starting a ladder would reach the same place with far more effort.
Mistakes that creep in
- Stopping at a composite. A branch ending in 4, 9 or 21 is not finished.
- Including 1. It is a factor of everything, but it is not prime and adds nothing to the list.
- Switching from products to sums. Splitting 12 into 7 + 5 is not factoring.
- Losing a branch. Count the ends of the tree carefully, or circle each prime as you reach it.
- Misreading exponents. The expression 2³ means 2 × 2 × 2 = 8, not 2 × 3.
- Giving up too early. If 2, 3 and 5 fail, keep going to 7, 11, 13 and onward up to the square root.
When an answer looks doubtful, multiply it out. If the product matches the starting number and every factor is prime, the factorization is correct, and the uniqueness theorem below says there is no rival answer.
Why the answer is unique
The fundamental theorem of arithmetic states that every whole number greater than 1 is either prime or can be written as a product of primes in exactly one way, apart from the order of the factors.
It has two parts. Existence is easy to see: keep splitting composites, and since the factors get smaller, the process must stop. Uniqueness is deeper. It depends on the fact that if a prime divides a product, it divides at least one of the factors. Composite numbers lack this: 6 divides 4 × 9 = 36, but it divides neither 4 nor 9.
Uniqueness is not automatic in every number system. Some extended systems studied in abstract algebra allow genuinely different factorizations, as in a ring where six factors two ways.
What the factorization tells you
Once you have the primes, several questions become easy.
Is it a perfect square? A number is a square exactly when every exponent is even. In 360 = 2³ × 3² × 5, the 2 and the 5 have odd exponents. Multiplying by 2 × 5 = 10 fixes both: 3,600 = 2⁴ × 3² × 5², which is 60².
How do you simplify its square root? Pair up the primes.
√360 = √(2² × 3² × 2 × 5) = 2 × 3 × √10 = 6√10 How many positive divisors does it have? Add 1 to each exponent and multiply. For 360 that is (3 + 1)(2 + 1)(1 + 1) = 24, because a divisor may use 0 to 3 twos, 0 to 2 threes and 0 or 1 five.
What does it share with another number? Comparing exponents gives the greatest common factor and the least common multiple.
Carrying the idea into algebra
Monomials factor the same way, with variables playing the role of extra primes.
12x²y = 2 × 2 × 3 × x × x × y
18xy³ = 2 × 3 × 3 × x × y × y × y
shared = 2 × 3 × x × y = 6xy Polynomials have their own version of primes: expressions such as x + 3 or x² + 1 that cannot be broken down further using the allowed coefficients. Factoring x² + 5x + 6 into (x + 2)(x + 3) is the algebraic cousin of writing 6 = 2 × 3. When you can no longer split any factor, you are done, just as with a tree whose branches all end in primes.
Reducing fractions and finding roots with primes
Factorizations make some arithmetic almost mechanical. To reduce 84/360, write both numbers as primes and cross out what they share.
84/360 = (2² × 3 × 7) / (2³ × 3² × 5)
= 7 / (2 × 3 × 5)
= 7/30 Nothing is left in common, so you know the fraction is fully reduced. There is no need to wonder whether a smaller factor slipped by.
The same lists handle products. To multiply 15/28 by 14/45, factor first: (3 × 5)/(2² × 7) times (2 × 7)/(3² × 5). Cancel one 2, the 7, the 5 and one 3, and you are left with 1/(2 × 3) = 1/6.
Cube roots work like square roots with groups of three. Since 216 = 2³ × 3³, its cube root is 2 × 3 = 6. For 108 = 2² × 3³, only the 3s form a full group, so the cube root of 108 is 3 times the cube root of 4.
A short practice set
- Factor 150.
- Factor 252.
- Factor 1,001.
- Is 113 prime?
- What is the smallest number you can multiply 48 by to get a perfect square?
Answers: 2 × 3 × 5²; 2² × 3² × 7; 7 × 11 × 13; yes, since 2, 3, 5 and 7 all fail and the next prime, 11, has a square of 121; the multiplier is 3, because 48 = 2⁴ × 3 and 144 = 12².
How many primes are there?
There are infinitely many, and the argument is old enough to appear in Euclid's Elements. Take any finite list of primes, multiply them all together and add 1. Dividing this new number by any prime on the list leaves a remainder of 1. Yet the new number is greater than 1, so it has some prime factor, which must be a prime missing from the list.
The new number need not be prime itself. With the list 2, 3, 5, 7, 11, 13, you get 30,031, which equals 59 × 509.
Common questions
Which method should I use?
Use a tree when you can see a big factor pair quickly, such as 400 = 20 × 20. Use a ladder when you want an orderly record or when no split is obvious.
Do I have to write exponents?
No, but 2⁵ × 7 is easier to compare and check than 2 × 2 × 2 × 2 × 2 × 7. The exponent counts how many times that prime appears. If exponents are new to you, read an introduction to exponents.
Is there a fast method for huge numbers?
No efficient method is publicly known for factoring very large numbers on ordinary computers, as of the mid-2020s. Some encryption systems depend on that difficulty. For school-sized numbers, trees and ladders are plenty.