Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var methods = require('./eulerMethods.js');
  2.  
  3. var problem12 = function() {
  4.   var n=1;
  5.   var triangle = 0;
  6.   var divisors
  7.   while (true) {
  8.     triangle +=n;
  9.     divisors=methods.divisors_count(triangle);
  10.     if (divisors>=100) {
  11.       console.log(triangle, divisors);
  12.     }
  13.     if (divisors >= 500) {return triangle}
  14.     n += 1;
  15.   }
  16. }
  17.  
  18. console.log(problem12());