Solved #89
Made the `factor` function in Python and C++ faster
Made the `factor` function in Haskell faster