old_contents: #!/bin/env python
  #寻找n以内的素数，看执行时间，例子100000内的素数
  
  def prime(n):
      all = range(n+1)
      flag = [1]*(n+2)
      flag[1] = 0		# 1 is not prime
      flag[n+1] = 1
      p=2
      while(p<=n):
          print p 
          i = 2*p    
          for i in range(n+1)[::p]: 
              flag[i] = 0
          while True:
              p += 1
              if(flag[p]==1):
                  break
  # test
  prime(100000)   
  
  # 9592 numbers        
  # time
  #real	0m58.866s
  #user	0m58.286s
  #sys	0m0.124s
  
new_contents: #!/bin/env python
  #-*-coding:utf-8-*-
  #寻找n以内的素数，看执行时间，例子100000内的素数
  import sys
  
  def prime(n):
      flag = [1]*(n+2)
      flag[1] = 0		# 1 is not prime
      flag[n+1] = 1
      p=2
      while(p<=n):
          print p 
          for i in xrange(2*p,n+1,p): 
              flag[i] = 0
          while 1:
              p += 1
              if(flag[p]==1):
                  break
  # test
  if __name__ == "__main__":
      n = int(sys.argv[1])
      prime(n)   
  
  # n = 100000,find 9592 primes        
  #$ time ./sushu.py 100000 |wc -l
  #9592
  
  #real	0m0.083s
  #user	0m0.078s
  #sys	0m0.009s
  
subject: fix a bug