The problem here is to find the sum of all of the 0-9 pandigital numbers that meet certain conditions.

Let *d*_{1} be the 1^{st} digit, *d*_{2} be the 2^{nd} digit, and so on. We are looking for numbers where:

*d*_{2}*d*_{3}*d*_{4}is divisible by 2*d*_{3}*d*_{4}*d*_{5}is divisible by 3*d*_{4}*d*_{5}*d*_{6}is divisible by 5*d*_{5}*d*_{6}*d*_{7}is divisible by 7*d*_{6}*d*_{7}*d*_{8}is divisible by 11*d*_{7}*d*_{8}*d*_{9}is divisible by 13*d*_{8}*d*_{9}*d*_{10}is divisible by 17

I solved this problem by first generating all of the 0-9 pandigital numbers with Python's permutations function. Then I removed all of the permutations that had zero as their first digit (since leading zeros aren't significant). Next, I removed all the numbers where d_{4} isn't even or here d_{6} is anything other than a 5 or 0.

After that I just worked through the remaining pandigitals and checked the divisibility of the remaining three digit strings. In my final script I end up checking all of the sub-strings. Clearly this is not necessary since once we find that one test is failed there is no need to check the others. However, since we only end up with a few pandigitals to check it doesn't make any difference.

Once I got the answer, I read the forum and discovered that this is not the most efficient method. Imagine my surprise!

```
def makeNumbers():
initial =list(permutations([0,1,2,3,4,5,6,7,8,9]))
pans = []
for item in initial:
if item[0] != 0 and item[3]%2 == 0 \
and (item[5] == 5 or item[5] == 0): pans.append(item)
return pans
print('Generating candidate 0-9 pandigitals')
candidates = makeNumbers()
qualified = []
print('Checking...')
for item in candidates:
digits, success = [], True
for d in item: digits.append(d)
d345 = digits[2]*100 + digits[3]*10 + digits[4]
d567 = digits[4]*100 + digits[5]*10 + digits[6]
d678 = digits[5]*100 + digits[6]*10 + digits[7]
d789 = digits[6]*100 + digits[7]*10 + digits[8]
d890 = digits[7]*100 + digits[8]*10 + digits[9]
if d345 % 3 != 0: success = False
if d567 % 7 != 0: success = False
if d678 % 11 != 0: success = False
if d789 % 13 != 0: success = False
if d890 % 17 != 0: success = False
if success:
result = ''
for d in digits:
result = result + str(d)
qualified.append(int(result))
answer = 0
for x in qualified:
answer += x
print (answer)
```