cleanup problem 1
refactored euler 5 to a functional style