I am new to the programming world. I was just writing this code in python to generate N prime numbers. User should input the value for N which is the total number of prime n
This might help:
import sys
from time import time
def prime(N):
M=100
l=[]
while len(l) < N:
for i in range(M-100,M):
num = filter(lambda y :i % y == 0,(y for y in range(2 ,(i/2))))
if not num and i not in [0,1,4]:
l.append(i)
M +=100
return l[:N]
def dotime(func, n):
print func.__name__
start = time()
print sorted(list(func(n))),len(list(func(n)))
print 'Time in seconds: ' + str(time() - start)
if __name__ == "__main__":
dotime(prime, int(sys.argv[1]))