more idiomatic haskell solution to euler 22