I challenge you to come up with a shorter/simpler piece of code that executes the Sieve of Erathostenes than this Python snippet:

N = 1000
candidates = range(2, N+1)
i = 0

while i < len(candidates):
    candidates = [n for n in candidates
        if n % candidates[i] != 0
        or n <= candidates[i]]
    i += 1

print candidates

Of course, renaming variables or such silliness does not count. I know that a stopping condition of candidates[i] < math.sqrt(N) would make the whole thing faster, but that’s beside the point. This is about simplicity.

So, go ahead and humiliate me. I know you want to. }:)