Created
March 3, 2015 01:34
-
-
Save ajnadel/0cf054de01f7695d070f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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