Skip to content

Instantly share code, notes, and snippets.

@atsjj atsjj/gist:4166255
Created Nov 29, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.