0PricingLogin
Competitive Programming Academy · Lesson

Sieve of Eratosthenes

List all primes up to N in near-linear time.

Primes in Bulk

Sometimes you need every prime up to N, not just one check. The Sieve of Eratosthenes finds them all in one sweep. 🧹

The Big Idea

Start by assuming every number is prime. Then cross out the multiples of each prime you find, leaving only true primes behind.

All lessons in this course

  1. GCD, LCM & the Euclidean Algorithm
  2. Primality Testing up to sqrt(n)
  3. Sieve of Eratosthenes
  4. Prime Factorization & Divisors
← Back to Competitive Programming Academy