Replace factor-of-number with implementation using partial