Question: Write a function named prime_factors that takes an integer as a parameter and returns a list containing all its smallest prime factors. For example, the

 Write a function named prime_factors that takes an integer as a

Write a function named prime_factors that takes an integer as a parameter and returns a list containing all its smallest prime factors. For example, the number 120 has prime factors of 2, 2, 2, 3, 5, so the function should return: [2, 2, 2, 3, 5] For example: Test Result print(prime_factors(120)) [2, 2, 2, 3, 5] print(prime_factors(26)) [2, 13]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!