Array of Prime Factors

Published by Mubashir Hassan 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

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

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

primeFactorization(23) ➞ [23]

Notes

N/A

Watch a quick demo on how Edabit works.