Moved problems till e045.py to Python 2.

This commit is contained in:
2019-07-16 21:17:21 -04:00
parent ddb61ff731
commit 301033d17d
20 changed files with 324 additions and 0 deletions

31
python/e043.py Normal file
View File

@@ -0,0 +1,31 @@
from lib_misc import permutations
def is_sub_string_divisible(s):
s = "".join(s)
if int(s[1:4]) % 2 != 0:
return False
if int(s[2:5]) % 3 != 0:
return False
if int(s[3:6]) % 5 != 0:
return False
if int(s[4:7]) % 7 != 0:
return False
if int(s[5:8]) % 11 != 0:
return False
if int(s[6:9]) % 13 != 0:
return False
if int(s[7:10]) % 17 != 0:
return False
return True
def euler_043():
return sum([int("".join(p))
for p in permutations("0123456789")
if is_sub_string_divisible(p)])
if __name__ == "__main__":
print("e043.py: " + str(euler_043()))
assert(euler_043() == 16695334890)