← Back to challenges

List of Prime Factors

PythonHardnumbersmath

Instructions

Write a function that returns the extended form of the prime factorization of a number. Return in the format [a, b, c, d, ...], where each element of the list is an integer.

Examples

prime_factorization(216) ➞ [2, 2, 2, 3, 3, 3]

prime_factorization(64) ➞ [2, 2, 2, 2, 2, 2]

prime_factorization(23) ➞ [23]

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.