题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
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 let num = 0; while(line = await readline()){ num = parseInt(line); } let result = []; let i=2; while(i<=num && i * i <= num){ // for(let i=2; i<=num; i++){ while(num%i===0 && num!==i){ result.push(i); num = num/i; } ++i; // if(num == i){ // result.push(i); // break // } } if(num !=1){ result.push(num) } console.log(result.join(" ")) return result.join(" "); }()