Created
March 5, 2010 10:09
-
-
Save 0mg/322616 to your computer and use it in GitHub Desktop.
円周率計算ブックマークレット
This file contains hidden or 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
// Spigot Algorithm | |
// http://www14.ocn.ne.jp/~kk62526/pi/Spigot.html | |
javascript: | |
for(a=[],c=52514,f=1e4,d=h=0;b=c-=14; | |
document.write("<li>",("000"+(e+d/f|0)).slice(h=-4))) | |
for(e=d%=f;g=--b*2;d=d/g|0)d=d*b+f*(h?a[b]:f/5),a[b]=d%--g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment