Skip to content

Instantly share code, notes, and snippets.

@dwaite
Created February 2, 2011 08:26
Show Gist options
  • Save dwaite/807400 to your computer and use it in GitHub Desktop.
Save dwaite/807400 to your computer and use it in GitHub Desktop.
factorial := method(n,
if(n == 0, return 1)
res := 1
Range 1 to(n) foreach(i, res = res * i)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment