def main(): for i in PrimeGenerator(under=9999): if i < 1488: continue else: counter = 0 candidate = collector(find_permute(i)) for j in candidate: if j != i and is_prime(j) and is_prime(2 * j-i) and (2 * j - i) in candidate: return i, j, 2 * j - i
def main(): for i in PrimeGenerator(under=9999): if i < 1488: continue else: counter = 0 candidate = collector(find_permute(i)) for j in candidate: if j != i and is_prime(j) and is_prime(2 * j - i) and ( 2 * j - i) in candidate: return i, j, 2 * j - i
def main(): result = 0 limit = 1000000 chain_length = 0 mapping = {} current_chain = [] for x in range(2, limit + 1): if is_prime(x): continue current_chain = [] failed = False _x = x while _x not in current_chain: current_chain.append(_x) _x = get_proper_divisors(_x) if _x > limit or mapping.setdefault(_x, False): failed = True break if not failed: if len(current_chain) > chain_length: chain_length = len(current_chain) result = min(current_chain) for j in current_chain: mapping[j] = False return result
def main(): max_found = -1 for n in xrange(3, 10): for j in generator(n): if is_prime(j) and j > max_found: max_found = j print "Finally..", max_found
def verify(number): result = False for i in range(1, int(sqrt(number / 2)) + 1): if is_prime(number - i * i * 2): result = True break return result
def main(): max_found = -1 for n in range(3, 10): for j in generator(n): if is_prime(j) and j > max_found: max_found = j print("Finally..", max_found)
def verify(number): result = False for i in xrange(1, int(sqrt(number / 2))+1): if is_prime(number - i * i * 2): result = True break return result
def gen_odd_composite(): n = 1 while True: c = 2 * n + 1 if not is_prime(c): yield c n += 1
def gen_odd_composite(): n = 1 while True: c = 2 * n + 1 if not is_prime(c): yield c n += 1
def main(): result = 0 for i in range(1, 1000000): possible = True for j in num_rotate(i): if not is_prime(j): possible = False break result += possible print(result)
def main(): n, maxlen = 1000000, 0 Set = list(PrimeGenerator(under=10000)) newb = 2 for a in range(4): for b in range(newb, len(Set)): subset = Set[a:b] s = sum(subset) if is_prime(s) and s < n and len(subset) > maxlen: length = len(subset) sumprime = s maxlen = length newb = b print(sumprime)
def main(): n, maxlen = 1000000, 0 Set = list(PrimeGenerator(under=10000)) newb = 2 for a in range(4): for b in range(newb, len(Set)): subset = Set[a:b] s = sum(subset) if is_prime(s) and s < n and len(subset) > maxlen: length = len(subset) sumprime = s maxlen = length newb = b print(sumprime)
def test_length(a, b): n = 0 while is_prime(quadratic(n, a, b)): n += 1 return n
def check_number(number): possible = True for i in truncate_gen(number): if not is_prime(i): possible = False return possible
def test_length(a, b): n = 0 while is_prime(quadratic(n,a,b)): n += 1 return n
def check_pair(a, b): if is_prime(a * (10**len(str(b))) + b) and is_prime(b * (10**len(str(a))) + a): return True else: return False
def check_pair(a, b): if is_prime(a * (10**len(str(b))) + b) and is_prime(b * (10**len(str(a))) + a): return True else: return False