scripts/ege/файлы к варианту ДТараскин КЕГЭ/25.py

22 lines
465 B
Python
Raw Normal View History

2023-05-05 00:45:01 +03:00
def check_poly(n):
n = list(map(int, str(n)))
return all([n[i - 1] % 2 != n[i] % 2 for i in range(1, len(n))])
def dev(n):
for x in range(n - 1, 1, -1):
if n % x == 0:
return x % 7 == 0
return False
def get_dev(n):
for x in range(n - 1, 1, -1):
if n % x == 0:
return x
for i in range(1_000_000_000, 10_000_000_000):
if check_poly(i) and dev(i):
print(i, get_dev(i))