Created
November 29, 2012 01:52
-
-
Save atsjj/4166255 to your computer and use it in GitHub Desktop.
Permutation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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