Gamma Function Calculator
Evaluate the gamma function Γ(n) for a whole number n from 1 to 170, where Γ(n) = (n − 1)!, with the shift-by-one between gamma and factorial explained.
Gamma Function Calculator
Background.
The factorial answers a counting question: 5! = 120 is the number of ways to line up five books on a shelf. It only makes sense for whole numbers, though. In the eighteenth century Leonhard Euler found a smooth function that passes through every factorial and fills in the gaps between them, so that a question like "what is 4.5 factorial?" has an answer. In the notation Legendre later gave it, the gamma function is Γ(z) = ∫₀^∞ t^(z−1) e^(−t) dt, and its defining property is Γ(z + 1) = z × Γ(z), the same step-up rule factorials obey.
The detail that catches people out is a shift by one. Γ(n) equals (n − 1)!, not n!. So Γ(5) is 4! = 24, and Γ(1) is 0! = 1. Gauss worked with a version, Π(n) = n!, that had no shift, but Legendre's Γ is the one that stuck, and statistics tables and software libraries all follow it.
The input here is restricted to whole numbers from 1 to 170, the range where the gamma function and the factorial coincide and the answer is simply the product 1 × 2 × … × (n − 1). Fractions, negative numbers and complex arguments, where the integral itself is needed, are not covered, and neither is zero, where Γ has no value at all.
The upper limit is about the size of the numbers. Γ(170) = 169! is roughly 4.269 × 10³⁰⁴, and 171! would be about 1.241 × 10³⁰⁹, beyond the largest value, about 1.8 × 10³⁰⁸, that standard double-precision arithmetic can hold.
What is gamma function calculator?
The gamma function Γ(z) extends the factorial from whole numbers to almost every real and complex number. It is defined by Euler's integral for arguments with positive real part and extended to the rest of the complex plane, except the points 0, −1, −2 and so on, where it has no value. It satisfies Γ(1) = 1 and Γ(z + 1) = z × Γ(z), and for a positive integer n those two rules give Γ(n) = (n − 1)!.
How to use this calculator.
- Enter n as a whole number from 1 to 170. Decimals are refused, because only whole-number arguments are handled here.
- If what you actually want is n!, enter n + 1: ten factorial is Γ(11). Mixing the two is the most common slip with the gamma function.
- Read Γ(n). Large values appear in scientific notation; Γ(30), for instance, is about 8.842 × 10³⁰.
- For half-integer arguments such as 4.5, start from Γ(1/2) = √π and step up with Γ(z + 1) = z × Γ(z) by hand, as the questions below show.
The formula.
For a positive integer n, Γ(n) = (n − 1)! = 1 × 2 × 3 × … × (n − 1). The identity follows from Euler's integral in two steps. First, Γ(1) = ∫₀^∞ e^(−t) dt = 1. Second, integrating by parts shows Γ(z + 1) = z × Γ(z) for any z with positive real part. Applying the second rule repeatedly from n − 1 down to 1 gives Γ(n) = (n − 1) × (n − 2) × … × 1 × Γ(1). Each step multiplies by a larger number, so the values grow faster than any exponential. Stirling's approximation, n! ≈ √(2πn) × (n/e)ⁿ, describes that growth: for 10! it gives about 3,598,696 against the true 3,628,800, an error of 0.83%.
A worked example.
Take n = 5. Because Γ(n) = (n − 1)!, the answer is 4!, the product of the whole numbers from 1 to 4. Multiplying in order: 1 × 2 = 2, then 2 × 3 = 6, then 6 × 4 = 24. So Γ(5) = 24. The recurrence takes it one step further: Γ(6) = 5 × Γ(5) = 5 × 24 = 120, which is 5!. The integer values are only the fixed points of a smooth curve, though. Between them, Γ(5.5) = 4.5 × 3.5 × 2.5 × 1.5 × 0.5 × √π ≈ 52.343, sitting between 24 and 120. It is not a whole number, and it is not available on this page, which handles integer arguments only.
Frequently asked questions.
Why is Γ(n) equal to (n − 1)! rather than n!?
What is Γ(1/2), and how do I get other half-integers?
Why is there no answer for zero or negative whole numbers?
Are the very large results exact to the last digit?
Where does the gamma function turn up outside pure mathematics?
References& sources.
- [1]OpenStax, Rice University. College Algebra 2e, 2021. Algebra and function chapters. Retrieved 2026-08-06.
- [2]OpenStax, Rice University. Precalculus 2e, 2021. Trigonometry and analytic geometry chapters. Retrieved 2026-08-06.
- [3]NIST/SEMATECH. e-Handbook of Statistical Methods, 2012. Chapter 1.3 and Chapter 4. Retrieved 2026-08-06.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 3 cited below
- Method
- For a positive integer n, Gamma(n)=(n-1)!
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled