def main(): for i in range(1000, 10000): for j in range (1, (10000-i)/2): if isPrime(i) and isPrime(i+j) and isPrime(i+2*j): if isPerm(i, i+j) and isPerm(i, i+2*j) and not (i == 1487 and j == 3330): print str(i)+str(i+j)+str(i+2*j) return
def isTruncatable(n): m = str(n) while m != "": if not isPrime(int(m)): return False m = m[1:] m = str(n) while m != "": if not isPrime(int(m)): return False m = m[:-1] return True
def isCon(i): j = 1 while 2 * j * j < i: if isPrime(i - 2 * j * j): return True j += 1 return False
def main(): i = 35 while True: if not isPrime(i) and not isCon(i): break i += 2 print i
def isCircularPrime(n): m = n while isPrime(m): m = nextCircular(m) if n == m: return True return False
def main(): i = 9876543 while True: if isPrime(i): if set(str(i)) == set(str(j + 1) for j in range(len(str(i)))): print i return i -= 2
def main(): step = 2 n = 1 count = 0 while True: for i in range(4): if isPrime(n + i * step + step): count += 1 ratio = count*1.0/(step/2*4+1) if ratio < 0.1: print step + 1 return n += 4 * step step += 2
def main(): t = getPrimeList(1000000) totallen = len(t) length = 0 for i in range(totallen): if i+length >= totallen: break Sum = sum(t[i:i+length]) for j in range(i+length, totallen): Sum += t[j] if Sum > 1000000: break if j-i+1 > length and isPrime(Sum): length = j-i+1 Max = Sum print Max
def isConcatenatePrime(a, b): if isPrime(int(str(a)+str(b))) and isPrime(int(str(b)+str(a))): return True return False
def f(a, b): n = 0 while isPrime(g(a, b, n)): n += 1 return n