LeoColman
05/07/2019, 3:01 AMfor(int divisor = 2; n > 1; divisor++) {
for(; n % divisor == 0; n /= divisor) {
...
}
}
serebit
05/07/2019, 3:18 AMRuckus
05/07/2019, 3:19 AMwhile
loop. I prefer the while
version.serebit
05/07/2019, 3:22 AMAl Warren
05/07/2019, 3:25 AMfor (initialization; termination; increment) {
statement(s)
}
Which is pretty much the same as this except for the fact that the initialization is scoped within the loop.
initialization
while(termination) {
statement(s)
increment
}
serebit
05/07/2019, 3:27 AMAl Warren
05/07/2019, 3:30 AMLeoColman
05/07/2019, 3:32 AMAl Warren
05/07/2019, 3:41 AMvar n... comes from somewhere???
var divisor:int = 2;
while(n > 1) {
do {
...
n /= divisor
} while (n % divisor == 0)
divisor++
}
serebit
05/07/2019, 3:48 AMLeoColman
05/07/2019, 1:01 PM