-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem 043.py
More file actions
30 lines (27 loc) · 822 Bytes
/
Problem 043.py
File metadata and controls
30 lines (27 loc) · 822 Bytes
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
def isPandigital(n):
listedDigits = []
for i in str(n):
listedDigits.append(i)
listedDigits.sort()
listedDigits = "".join(listedDigits)
if listedDigits == "0123456789":
return True
else:
return False
def main():
divisors = [17, 13, 11, 7, 5, 3, 2]
pandigital = [ a + b + c for a in "0123456789" for b in "0123456789" for c in "0123456789"]
for n in divisors:
copy = pandigital[:]
for m in copy:
if int(m[0:3]) % n == 0:
for digit in "0123456789":
a = digit + m
pandigital.append(a)
pandigital.remove(m)
total = 0
for i in pandigital:
if isPandigital(int(i)) and i[0] != 0:
total += int(i)
return total
print main()