# Implementation of the Sieve of Eratosthenes (IronPython)

import sys
from System.Console import WriteLine

# guard
if len(sys.argv) != 2:
  WriteLine("Syntax: "+sys.argv[0]+" max")
  sys.exit(1)

# vars
max = int(sys.argv[1])
data = [1]*(max+1)

WriteLine("Primes below "+str(max)+":")

# algorithm
for x in range(2,max+1):
  if data[x]:
    print str(x)
    i = x+x
    while i <= max:
      data[i] = 0
      i += x
