Spent way too much time refactoring the euler 5 answer