Refactor away tiny largest-prime-factor function