きったんの頭

#! /usr/bin/env python3
"""
pe43.py
https://mind.kittttttan.info/py/pe43
"""

from itertools import permutations

# https://mind.kittttttan.info/py/pe0
from pe import list_num

def pe43():
    """
    Find the sum of all pandigital numbers
    with an unusual sub-string divisibility property.
    """
    # s = 0
    ps = []
    for perm in permutations((0,1,2,3,4,6,7,8,9)):
        if perm[3] & 1: continue
        perm = list(perm)
        perm.insert(5, 5)
        if not list_num(perm[7:10]) % 17 and \
           not list_num(perm[6: 9]) % 13 and \
           not list_num(perm[5: 8]) % 11 and \
           not list_num(perm[4: 7]) %  7 and \
           not list_num(perm[3: 6]) %  5 and \
           not list_num(perm[2: 5]) %  3:
            # s += list_num(perm)
            ps.append(list_num(perm))
    # print(s)
    print(ps)

if __name__ == "__main__":
    pe43()