Skip to content

Instantly share code, notes, and snippets.

@xnuk
Created April 30, 2014 15:47
Show Gist options
  • Save xnuk/fd0c5ffd76ccf3750ec0 to your computer and use it in GitHub Desktop.
Save xnuk/fd0c5ffd76ccf3750ec0 to your computer and use it in GitHub Desktop.
var fs=require("fs");
function j(s){
var d=s.length-1;
var b=[];
var c=0
for(var a=d;a>=0;a--){
var t=s.substr(a,1)*3+c //It's javascript lol
b.push(t%10);
c=Math.floor(t/10);
}
if(c!=0)b.push(c)
return b.reverse().join("");
}
var t=Date.now();
(function(a){
var d=Math.pow(3,20)+"";
for(var i=20;i<1000000;i++)var d=a(d);
console.log(Date.now()-t);
fs.writeFile("./output.txt",d,null);
})(j)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment