Optimised divisor count by deriving the result from prime factorisation