problem 13 and slow problem 14 solutions in Haskell