← Back to challenges

Array of Prime Factors

JavaScriptHardnumbersmath

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

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