Log in
← All problems

All primes up to n

mediumMaths and loops20 XP

Return all the prime numbers from 2 up to and including n, smallest first. For a fast answer, look up the Sieve of Eratosthenes.

Examples

Examples use JSON: true/false/null are True/False/None in Python.

Run examples checks the examples above. Submit also runs 3 hidden tests.