def sieve(n):
    """
    Get primes below n.

    >>> sieve(10)
    [2, 3, 5, 7]
    """
    if n < 2:
        return []
    s = [True] * (n + 1)
    s[0], s[1] = False, False
    sq = int(n ** 0.5)
    for i in range(2, sq + 1):
        if s[i]:
            m = n // i - i
            s[i * i : n + 1 : i] = [False] * (m + 1)
    return [i for i in range(n + 1) if s[i]]