stirling: Approximates a factorial of an integer n using Stirling's...

Description Usage Arguments Value References Examples

Description

Stirling's approximation is a method of approximating a factorial n!. As the value of n increases, the more exact the approximation becomes; however, it still yields almost exact results for small values of n. The approximation used is given by Gosper, which is noted to be a better approximation to n! and also results in a very close approximation to 0! = 1.

n! \approx √{(2n + \frac{1}{3})π} n^n e^{-n}

Usage

1

Arguments

n

desired integer to approximate factorial

Value

the approximated factorial, n! per Gosper's approximation

References

Stirling's approximation. (2017, March 8). In Wikipedia, The Free Encyclopedia. From https://en.wikipedia.org/w/index.php?title=Stirling Weisstein, Eric W. "Stirling's Approximation." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/StirlingsApproximation.html

Examples

1
2

aschleg/numberr documentation built on May 14, 2019, 10:31 a.m.