summaryrefslogtreecommitdiff
path: root/043.py
blob: 2dd1db9fe3f3165713854dfb2dcc24c63f3bd9b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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