xxxxxxxxxx
34
var factors=[];
var divisor=2;
var num=1000;
//34, 30, 28, 8
function setup() {
createCanvas(400, 400);
primes(num);
}
function draw() {
background(220);
}
function primes(num)
{
divisor=2;
var n=num;
//for (var i=0; i<n/2; i++)
while(n>=2)
{
if(n%divisor==0)
{
factors.push(divisor);
n=n/divisor;
}
else
{
divisor++;
}
}
console.log(factors);
}