📚 Sieve of Eratosthenes
Ancient algorithm to find all primes up to N:
- Start with all numbers 2 to N (unmarked = potentially prime)
- Find the smallest unmarked number (it's prime!)
- Mark all its multiples as composite (2p, 3p, 4p, ...)
- Repeat until you've processed all numbers up to √N
- All remaining unmarked numbers are prime! 🎉
Time Complexity: O(N log log N) - very efficient!