Problem 47
Instead of building yet another function to calculate prime factors and sieves, I used an existing package: NumberTheory.Sieve.Factor to solve the 47th Euler problem:
The function f calculates a list of pairs containing a number and the number of its prime factors, and filters all numbers that do not have 4 prime factors. Then it is a matter of calling the consec function, that returns the first 4 consecutive integers that have exactly 4 prime factors. The program executes in (0.38 secs, 143730392 bytes).
blog comments powered by Disqus