input: Write a python function to find all prime numbers smaller than or equal to a given number using the sieve of Eratosthenes algorithm.
  assert sieve(10) == [2, 3, 5, 7]
  assert sieve(20) == [2, 3, 5, 7, 11, 13, 17, 19]
  assert sieve(1) == []
  assert sieve(30) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
output: def sieve(n):
      if n < 2:
          return []
      primes = [True] * (n + 1)
      primes[0] = primes[1] = False
      p = 2
      while p * p <= n:
          if primes[p]:
              for i in range(p * p, n + 1, p):
                  primes[i] = False
          p += 1
      return [p for p, is_prime in enumerate(primes) if is_prime]