@@ -0,0 +1,940 @@
+#!/usr/bin/env python%0A#-*-coding:utf-8-*-%0A%0A'''%0A%0A'''%0A%0Afrom itertools import permutations%0Aimport math%0Aimport timeit%0A%0A%0Adef is_prime(n):%0A    for i in range(2, int(math.sqrt(n))+1):%0A        if n %25 i == 0:%0A            return False%0A    return True%0A%0A%0Adef calc():%0A    seqs = %5B%5D%0A    for i in range(1000, 9999):%0A        if not is_prime(i): continue%0A        perms = list(set(%5Bint(''.join(s)) for s in permutations(str(i), 4)%5D))%0A        perms.sort()%0A        for j in range(0, len(perms)):%0A            if perms%5Bj%5D %3C i: continue%0A            if not is_prime(perms%5Bj%5D): continue%0A            for k in range(j, len(perms)):%0A                if not is_prime(perms%5Bk%5D): continue%0A                if (perms%5Bj%5D-i)*2 == perms%5Bk%5D-i and perms%5Bk%5D-i %3E 0:%0A                    seqs.append(''.join(map(str, %5Bi, perms%5Bj%5D, perms%5Bk%5D%5D)))%0A    return seqs%0A%0A%0Aif __name__ == '__main__':%0A    print calc()%0A    print timeit.Timer('problem_049.calc()', 'import problem_049').timeit(1)%0A

add problem 049