# uses the sieve of Eratosthenes for listing all primes upto a given number
from array import array
MAX=1000;
# create an array of MAX elements listed as true or false
arr=[]
for i in range(MAX):
arr.append(1);
for i in range(MAX):
number=i+1;
if number == 1:
continue;
x=arr[i];
if x == 1 :
print number;
# update the array by passing an additional sieve
curIdx = i;
while curIdx < MAX:
arr[curIdx] = 0;
curIdx = curIdx + number; # take multiples of i