Haskell solution to euler 71.