Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import *
- def foo(n):
- if n < 1:
- return False
- sq = round(sqrt(n)) + 10
- for i in range(2, sq):
- if n % i == 0:
- return False
- return True
- f = list(map(int, open("C:/tmp/17.txt").readlines()))
- max17 = -10**8
- for i in f:
- if abs(i) % 100 == 17:
- max17 = max(i, max17)
- cnt = 0
- maxMul = 0
- for i in range(len(f)-1):
- if (foo(f[i]) and not foo(f[i+1]) or foo(f[i + 1]) and not foo(f[i])) and ((f[i] + f[i + 1]) % max17 == 0):
- cnt += 1
- maxMul = max(maxMul, f[i] * f[i+1])
- print(cnt, maxMul)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement