Implement `prime_factor_multiplicities()`