Sieve of Eratosthenes

Medium
math Google Citadel DE Shaw

Find all prime numbers up to a given limit n using the Sieve of Eratosthenes.

Example

sieve(30)
# => [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

Test Cases

Python Editor

Output

Click "Run" to see results...