题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
// 1.质因子为质数
// 2.n的质因子范围为 2 <= x <= 根号n
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void async function () {
// Write your code here
while(line = await readline()){
let num = parseInt(line)
const list = []
for(let i = 2; Math.pow(i, 2) <= num; i++) {
while(num % i === 0) {
list.push(i)
num /= i
}
}
if (num > 1) {
list.push(num)
}
console.log(list.join(' '))
}
}()