2016_8_21
判断素数,不难
但是pat判题我发现导入numpy,pandas等包会提示返回值非零的错误,但是导入math包不会
code
# -*- coding: utf-8 -*-
"""
Spyder Editor
author hanzy
This is a temporary script file.
"""
import math
def issushu(num):
for i in range(int(math.sqrt(num))):
if((i+1 != 1) and (num % (i+1) == 0)):
return 0
return 1
if __name__ == "__main__":
num = input()
count = 0
for i in range(3,num,2):
if(issushu(i) == 1 and issushu(i+2)==1 and (i+2<=num)):
count += 1
print count