def eratosthenes_sieve(n):
    """Return primes <= n."""

    def add_prime(k):
        """Add founded prime."""
        primes.append(k)
        pos = k + k
        while pos <= n:
            numbers[pos] = 1
            pos += k

    numbers = [0] * (n + 1)
    primes = [2]
    for i in range(3, n + 1, 2):
        if not numbers[i]:
            add_prime(i)
    return primes