Array of Prime Factors

Published by Matt in

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 array 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

Watch a quick demo on how Edabit works.