def calc_prime(prime,num): i,gab=7,2 while num>3: flag=True for x in prime: if x*x>i: break if i%x==0: flag=False break if flag: prime.append(i) if len(prime)>=num: break gab=6-gab i+=gab return prime[num-1] #调用 print calc_prime([2,3,5],1000)
def calc_prime(prime,num): i,gab=7,2 while num>3: flag=True for x in prime: if x*x>i: break if i%x==0: flag=False break if flag: prime.append(i) if len(prime)>=num: break gab=6-gab i+=gab return prime[num-1] #调用 print calc_prime([2,3,5],1000)