All Tools

Prime Factorization & Sieve Visualizer

Factor any number into primes and see a branching factor tree. Or animate the Sieve of Eratosthenes to watch primes being found step by step as composites are crossed out by color.

Presets
Prime Factorization of 60
60 = 2² × 3 × 5

Factor Tree

Teal = prime leaf  Amber = composite

6023021535

Step-by-Step Division

1.60÷2=30
2.30÷2=15
3.15÷3=5
4.5÷5=1(done)

Prime Factors

2
power: 2 (2²)
3
power: 1
5
power: 1
Number of prime factors
3 distinct
Total divisor count
12
Primes up to 60
17

GCD and LCM with Related Numbers

Number pairGCDLCM
60 and 4460
60 and 93180
60 and 255300

Reference Guide

Prime Numbers

A prime number is a whole number greater than 1 that has exactly two divisors: 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23...

2 is the only even prime. All other even numbers are divisible by 2, so they are composite. There are infinitely many primes, as Euclid proved around 300 BCE.

π(100)=25 primes up to 100\pi(100) = 25 \text{ primes up to } 100

The prime-counting function π(n)\pi(n) counts primes up to nn. It grows roughly as n/lnnn / \ln n by the Prime Number Theorem.

Fundamental Theorem of Arithmetic

Every integer greater than 1 is either prime or can be written as a unique product of prime numbers (up to the order of the factors). This is the Fundamental Theorem of Arithmetic.

360=23×32×5360 = 2^3 \times 3^2 \times 5

A factor tree finds prime factors by repeatedly splitting a composite number. Every path from root to leaf ends at a prime. No matter how you split, you always get the same set of primes.

Sieve of Eratosthenes

The Sieve of Eratosthenes is an ancient algorithm for finding all primes up to a limit nn. The steps:

  1. Write out numbers 2 through nn.
  2. Find the first unmarked number (a prime). Cross out all its multiples starting from its square.
  3. Repeat until you reach n\sqrt{n}. All remaining unmarked numbers are prime.
Time complexity: O(nloglogn)\text{Time complexity: } O(n \log \log n)

GCD and LCM

The Greatest Common Divisor (GCD) is the largest number that divides both aa and bb. The Least Common Multiple (LCM) is the smallest number divisible by both.

gcd(12,18)=6\gcd(12, 18) = 6 lcm(12,18)=36\text{lcm}(12, 18) = 36

Using prime factorizations, take the product of shared primes (minimum exponents) for the GCD, and the product of all primes (maximum exponents) for the LCM. The identity gcd(a,b)×lcm(a,b)=a×b\gcd(a,b) \times \text{lcm}(a,b) = a \times b always holds.