Skip to content

Instantly share code, notes, and snippets.

@mattfitzgerald
Created December 4, 2011 22:27
Show Gist options
  • Save mattfitzgerald/1431496 to your computer and use it in GitHub Desktop.
Save mattfitzgerald/1431496 to your computer and use it in GitHub Desktop.
e
# calculates e
e = (1..20).inject(1){|e,n| e + 1.0/((1..n).inject(:*))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment