SHARE
TWEET

Untitled

a guest Jan 20th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2.  
  3. def sieve_of_eratosthenes(limit):
  4.     is_prime = np.ones(limit + 1, dtype=np.bool)
  5.     is_prime[[0, 1]] = False
  6.     for i in range(2, limit + 1):
  7.       if is_prime[i]:
  8.         is_prime[np.arange(i * i, limit + 1, i)] = False
  9.     return np.where(is_prime)[0]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top