This is as far as I've gotten. I have factored the numbers successfully, but I just need to distribute and divide them into the pOverQ array.
var p = readInt("What is your p: ");
var q = readInt("What is your q: ");
var factorP = [];
var factorQ = [];
var pOverQ = [];
var num = 0;
function start(){
factor(p, q);
println(factorP);
println(factorQ);
p_Q(p, q);
println(pOverQ);
}
function factor(p ,q){
for(var i = 1; i <= p; i++) {
if(p % i == 0){
factorP.push(i);
}
if(q % i == 0){
factorQ.push(i);
}
}
}
function p_Q(p, q){
for(var i = 0; i < (factorP.length)*2; i++){
pOverQ.push(factorP[i]/factorQ[i]);
}
}
I hope you can help!!!