Hacker News new | past | comments | ask | show | jobs | submit login

"Again, no recursion is required as long as one knows that a factorial is actually a special case of the gamma function. (The implementation of log-gamma is usually a polynomial approximation which requires constant time to evaluate.)"

A prime idea behind using recursive techniques is that for many complex problems you do not have to know the "special case" as you can break complex problems into simpler pieces that can be solved via recursion.




I would be surprised if there is not some kind of loop in the code that is used to evaluate the gamma function. You can also define factorial like for example the number of different permutations of any set of a given size.


outside of edge cases, c++ lgamma (log of gamma) uses Lanczos iteration with 8 iterations and gamma is just exp(lgamma)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: