Input a number and the script will give you all the factors of the number. Great for certain
algebraic functions.
In Action
Code
The javascript to obtain the resalts is fairly simple.
function compute() {
var i;
var b = '';
// Gather input
var num = document.getElementById('input').value;
// Cycle through found factors
for (i = 0; i < num/2; i++) {
// Do the math
if(num % i == 0) {
if (num/i < i) {
break;
}
else {
b += i + " : " + num/i + "<br>";
}
}
}
// Display results
document.getElementById('blocks').innerHTML = b;
}
I wrote this script a long time ago and forgot what some of the math section does :P. I'll try
to get more comments in there sometime.