def eratosthenes(end, start=2, return_boolean=False):
 primes = []
 if ((end < start) or (end < 2)):
  return []
 is_prime = [True for i in range((end + 1))]
 is_prime[0] = is_prime[1] = False
 for i in range(2, (end + 1)):
  if (not is_prime[i]):
   continue
  if (start <= i <= end):
   primes.append(i)
  j = (i * i)
  while (j <= end):
   is_prime[j] = False
   j += i
 if return_boolean:
  return (primes, is_prime)
 return primes

def eratosthenes ( end , start = 2 , return_boolean = False ) : primes = [ ] if ( ( end < start ) or ( end < 2 ) ) : return [ ] is_prime = [ True for i in range ( ( end + 1 ) ) ] is_prime [ 0 ] = is_prime [ 1 ] = False for i in range ( 2 , ( end + 1 ) ) : if ( not is_prime [ i ] ) : continue if ( start <= i <= end ) : primes . append ( i ) j = ( i * i ) while ( j <= end ) : is_prime [ j ] = False j += i if return_boolean : return ( primes , is_prime ) return primes
finds all primes < end .