euler 183 solution in python and partial solution in haskell