~/boss / prime-hunt

Sieve of Eratosthenes

The Prime Hunt

Only the primes are real bosses. Cross out the fakes and know when to stop.

Loading the fight…

How to beat it

Start at 2: it's prime, so cross out its multiples. The smallest number still standing is the next prime; cross out its multiples starting from its square, because the smaller ones already fell to smaller primes. Once the next prime's square is past the end, everything still standing is prime.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/count-primes there. Sign in with your email to keep your progress on every device.

More bosses

esc