Help for this page

Select Code to Download


  1. or download this
    use Math::Prime::Util qw/forprimes/;
    forprimes { say } 1000;  # optionally takes range a,b
    
  2. or download this
    from sympy import sieve
    for i in sieve.primerange(2,1000):
      print i
    
  3. or download this
    import gmpy2
    n = 2
    while n <= 1000:
      print n
      n = gmpy2.next_prime(n)
    
  4. or download this
    from math import sqrt, ceil
    
    ...
    
    for i in rwh_primes(1000):
      print i