1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
   | import time
try: import psyco; psyco.full() 
except: pass
 
def nb(): 
          nbre,notFound=1,True 
          while notFound: 
                ##print "bcl1 " , notFound 
                divStart,divEnd=1,20 
                divisible=True 
                while divisible and divStart <= divEnd: 
                      ##print "  bcl2 ",divisible, "  -- nbre=",nbre, "  divStart=",divStart,"  - divEnd=",divEnd 
                      if nbre % divStart == 0: 
                         divStart += 1 
                      else: 
                         divisible = False 
                ##print "     ---- after while ", divisible
                if divisible: 
                   notFound = False 
                   print "  found ", nbre 
                else: 
                     nbre+=1
                     if nbre%1000000 == 0: print nbre
 
a = time.clock()
nb()
b = time.clock()
 
print b-a | 
Partager