Added solution to Euler's 27th problem - needs refactoring