text: def SieveOfEratosthenes(limit=10**6):
      """Returns all primes not greater than limit."""
      isPrime = [True]*(limit+1)
      isPrime[0] = isPrime[1] = False
      primes = []
      for i in range(2, limit+1):
          if not isPrime[i]:continue
          primes += [i]
          for j in range(i*i, limit+1, i):
              isPrime[j] = False
      return primes
  