PE Problem 27 Python

Problem 27 solution. Needs to optimized, runs in ~38 seconds on home machine.