getPrimeFactors.js
373 Bytes
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function getPrimeFactors(num) {
var i = 2;
var res = [];
var p = 0;
while (num > 1) {
if (num % i === 0) {
res.push(i);
num /= i;
i = 2;
} else {
i++;
}
}
return res;
}
exports["default"] = getPrimeFactors;
module.exports = exports["default"];