Added solution to Euler's 23rd problem - needs refactoring