primePaddingHeuristic is built on largestPrimeFactor, but that function is overkill. We don't care what the largest prime factor is, just whether it's larger than 5. Write a new function that returns a bool of whether the number's largest prime factor is larger than some threshold: largestPrimeFactorIsLargerThan(n, p). This function can bail early if it divides out all the prime factors below that limit, but the number still hasn't been reduced to 1.
primePaddingHeuristic
is built onlargestPrimeFactor
, but that function is overkill. We don't care what the largest prime factor is, just whether it's larger than 5. Write a new function that returns a bool of whether the number's largest prime factor is larger than some threshold:largestPrimeFactorIsLargerThan(n, p)
. This function can bail early if it divides out all the prime factors below that limit, but the number still hasn't been reduced to 1.