//define the uc-namespace var com = com||{}; com.unitedCoders = com.unitedCoders||{}; com.unitedCoders.Numbers1 = function(){ this.maxLoop = 100; /* calculate all divisors of n and return the sum of it @var n int - number to be checked @return the sum of all divisors */ this.countcalc = 0; this.calcSumOfDivisors = function(n) { //include the divisor 1 this.countcalc ++; var sum = 1; var middle = Math.sqrt(n); for (var i=2; i <= middle; i++) { if (n % i === 0) { sum += i; sum += n/i; } } return sum; }; /* generate a cycle and break if maxLoop or n=1 or n to great @var start int - start number of loop @return [int] - calculated loop */ this.countcycle = 0; this.calcCycle = function(start) { this.countcycle++; var last = start, f = [], max = 100*start, length; do { last = this.calcSumOfDivisors(last); length = f.push(last); } while (start!==last && last>1 && length1 && length1 && length"; } node.innerHTML = inner; } node = document.getElementById(mode+variant); if (node) { node.innerHTML = com.unitedCoders.NumberRunner.getTime(variant, end)+" ms."; node.onclick = function(){ com.unitedCoders.NumberRunner.run(mode, variant); }; } } } };