Skip to content

Instantly share code, notes, and snippets.

@atsjj
Created November 29, 2012 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atsjj/4166255 to your computer and use it in GitHub Desktop.
Save atsjj/4166255 to your computer and use it in GitHub Desktop.
Permutation
Math.perm = (n = 1, i, s = 0) ->
i = (if n <= 1 then 1 else n) unless i?
return n if i <= 1 or n <= 1 or i <= s + 1
i--
Math.perm n * i, i, s
stack = []
stack.push (Math.perm(50,null,44) / Math.perm(6)) / i for i in [1..100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment