Problem 9 solved in haskell