Guest User

Untitled

a guest
Sep 25th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import datetime
  2. def main():
  3. pass
  4.  
  5. if __name__ == '__main__':
  6. main()
  7.  
  8. start = datetime.datetime.now()
  9.  
  10. maxv = 15000
  11.  
  12. tab = ( maxv ) * [ True ]
  13.  
  14. for i in range( 2, int( maxv ** 0.5 ) + 1 ):
  15. if tab[ i ] == False: continue
  16. for j in range( i, maxv // i + 1 ):
  17. if j * i >= maxv: continue
  18. tab[ j * i ] = False
  19.  
  20. print( [ x for x in range( 2, maxv ) if tab[ x ] == True ] )
  21.  
  22. duration = datetime.datetime.now() - start
  23.  
  24. print(duration)
Advertisement
Add Comment
Please, Sign In to add comment