# Factorial Calculation Using Stirlings Formula

Calculator find the Factorial n for given Number of elements.

Calculator is using Stirling's formula gives an approximate value for the factorial function n! for n < 0.

The factorial function n! is important in computing binomial, hypergeometric, and other probabilities.

If n is not too large, then n! can be computed directly, multiplying the integers from 1 to n, or person can look up factorials in some tables.

Stirling’s formula provides an approximation which is relatively easy to compute and is sufficient for most of the purposes.

Using n! ≈ √(2π) x n^{(n+1/2)}x e ^{-n}

where n is number of elements.

### Example

The factorial of n is represented by n!. The factorial of n means, we have to multiply all the whole numbers from n down to 1.

The factorial of 5 is calculated as follows:

Factorial of 5 (5!) = 5 x 4 x 3 x 2 x 1.

Factorial of 5 = 118.

To Find: 5 factorial. Using Stirling Formula

n! ≈ √(2π) x n^{(n+1/2)} x e ^{-n}

n! ≈ √(2xπ) x 5^{(5+1/2)} x e ^{-5}

= 118.019