Solved problem 16, 17
Speed up using Data.List (took 19s)