Skip to content

Instantly share code, notes, and snippets.

@ajnadel
Created March 3, 2015 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajnadel/0cf054de01f7695d070f to your computer and use it in GitHub Desktop.
Save ajnadel/0cf054de01f7695d070f to your computer and use it in GitHub Desktop.
var F = require('fractional').Fraction;
var colors = require('colors'); /* unused */
var hardLimit = 20; /* times */
var divisor = eval(process.argv[2]);
var value = 0;
var path = '';
var m ='';
for (var i = 1; i < hardLimit; i++) {
var res = Math.pow(divisor, i);
if(res < Number.MIN_VALUE){ m += 'Reached mininum number val'.red; break; }
value += res;
path += (path&&' + ')+res;
}
console.log(path);
console.log(value);
m&&console.log(m);
console.log(('Limit ~= ' + new F(value)).green);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment