Skip to content

Instantly share code, notes, and snippets.

@dbb
Created March 14, 2011 20:10
Show Gist options
  • Save dbb/869773 to your computer and use it in GitHub Desktop.
Save dbb/869773 to your computer and use it in GitHub Desktop.
leibniz' formula for pi
perl -wle 'for(0..10**7){if($_%2==0){$s+=(4/((2*$_)+1));}else{$s-=(4/(2*$_+1));}print$s}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment