input: from typing import List
  
  def primeSieve(n: int) -> List[int]:
      """Generate a list of all prime numbers up to a given number n using the Sieve of Eratosthenes.
      >>> primeSieve(10)
      [2, 3, 5, 7]
      >>> primeSieve(20)
      [2, 3, 5, 7, 11, 13, 17, 19]
      """
output:     if n < 2:
          return []
      is_prime = [True] * (n + 1)
      is_prime[0] = is_prime[1] = False
      for i in range(2, int(n**0.5) + 1):
          if is_prime[i]:
              for j in range(i*i, n + 1, i):
                  is_prime[j] = False
      return [i for i in range(n + 1) if is_prime[i]]