Primes program from Problems for Computer Solution
from math import * def primes(): a=[0]*1001; b=[0]*201 for x in range(2,1001): a[x]=0 c=0 s=sqrt(1000) for b1 in range(2,1001): if a[b1]<0: continue c+=1 b[c]=b1 if b1>s: continue for x in range(b1,1001,b1): a[x]=-1 print() for x in range(1,c+1): print(b[x]," ",end="")