summaryrefslogtreecommitdiff
path: root/043.py
diff options
context:
space:
mode:
Diffstat (limited to '043.py')
-rw-r--r--043.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/043.py b/043.py
new file mode 100644
index 0000000..2dd1db9
--- /dev/null
+++ b/043.py
@@ -0,0 +1,35 @@
+from common import pandigital
+
+
+def check_number(i):
+ x = str(i)
+ if int(x[1:4]) & 1 != 0:
+ return False
+ if int(x[2:5]) % 3 != 0:
+ return False
+ if int(x[3:6]) % 5 != 0:
+ return False
+ if int(x[4:7]) % 7 != 0:
+ return False
+ if int(x[5:8]) % 11 != 0:
+ return False
+ if int(x[6:9]) % 13 != 0:
+ return False
+ if int(x[7:10]) % 17 != 0:
+ return False
+ return True
+
+
+numbers = pandigital(0, 9).numbers(11)
+
+result = 0
+
+for i in numbers:
+ if i < 1000000000:
+ continue
+
+ if check_number(i):
+ result += i
+
+print result
+