#36093: Python已盡量簡化還是TLE,請問以下要怎麼簡化


s10930088@zlsh.tp.edu.tw (陳濬承)


def is_prime(a):
    if a==1:
        return 0
    else:
        for i in range(3,int(a**0.5+1),2):
            if a%i==0:
                return 0
    return 1

while True:
    try:
        count = 0
        a,b = map(int,input().split(' '))
        for i in range(a,b+1):
            if i == 2 or i==5 or i==3:
                count+=1
            elif (i-1)%6==0 or (i-5)%6==0:
                count+=is_prime(i)
                #print(i)
            else:
                continue
        print(count)
    except EOFError:
        break