I\'m going crazy: Where is the Ruby function for factorial? No, I don\'t need tutorial implementations, I just want the function from the library. It\'s not in Math!
In math, factorial of n is just the gamma function of n+1 (see: http://en.wikipedia.org/wiki/Gamma_function)
factorial of n
gamma function of n+1
Ruby has Math.gamma() so just use Math.gamma(n+1) and cast it back to an integer if desired.
Math.gamma()
Math.gamma(n+1)