Using our prime factorisation again and basic Haskell