An intern has made a function to calculate all the unique prime factors for numbers in range of 2 through 1000 as part of their work. However, their code is extrememly slow and has been causing major slippage issues. You, after proving your knowledge through the previous steps are now tasked with optimizing their code.
- OPTIONAL: Run the initial code to see the time.
- Optimize the given code to run below .07 seconds for calculating the prime factorization of all numbers from 2-2500, including 2, excluding 2500.
- PR this change.
- Write code that runs below .0001 seconds for calculating the prime factorization of all numbers from 2-2500, including 2, excluding 2500.
- PR.
Please include the following when you are writing your PR:
General things:
- What is the purpose of this PR?
- What changes did you make? Why?
- What bugs did you find while testing?
This PR Specific:
- How does this make the code faster? How much headroom do you have?