6. 找素 number

An arithmetic sequence is provided, the first element 367, a tolerance 186, 151 is now required to find the prime number belonging to such a difference in the number of columns and output.

Format: CTF {xxx}

num = 367
d = 186
count = 0

while 1 :
num = num+d
max = int(num/2)
for i in range(2,max+1):
if num % i == 0:
break
if i == max:
count += 1
if count == 150:
print("CTF{%d}"%num)
break

 

Guess you like

Origin www.cnblogs.com/DennyT/p/11331498.html