Audited 05 Aug 2026·Last updated 28 Oct 2026·3 citations·Tier 2·0 uses

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

Gamma(n)
24
The value of the gamma function at n, equal to (n − 1)!; a pure number with no units.

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.

  1. Enter n as a whole number from 1 to 170. Decimals are refused, because only whole-number arguments are handled here.
  2. 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.
  3. Read Γ(n). Large values appear in scientific notation; Γ(30), for instance, is about 8.842 × 10³⁰.
  4. 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, Gamma(n)=(n-1)!

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.

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.

positive Integer5

Frequently asked questions.

Why is Γ(n) equal to (n − 1)! rather than n!?
It is a historical convention. Euler's integral, written the way Legendre wrote it, lands on (n − 1)! at whole numbers. Gauss used a function Π(n) equal to n!, which avoids the shift, but Legendre's notation became standard. So whenever you see Γ, remember that Γ(n + 1) = n!.
What is Γ(1/2), and how do I get other half-integers?
Γ(1/2) = √π ≈ 1.7725, one of the few non-integer values with a simple closed form. The recurrence then gives the rest: Γ(3/2) = ½ × √π ≈ 0.8862 and Γ(5/2) = 1.5 × 0.8862 ≈ 1.3293. This page does not evaluate them; it accepts whole numbers only.
Why is there no answer for zero or negative whole numbers?
The gamma function has poles there: as the argument approaches 0, −1, −2 and so on, the value runs off to plus or minus infinity. Negative non-integers do have finite values, for example Γ(−1/2) = −2√π ≈ −3.5449, but they are outside what this page computes.
Are the very large results exact to the last digit?
Up to Γ(23) = 22! = 1,124,000,727,777,607,680,000 they are. Beyond that the factorials have more digits than ordinary double-precision numbers carry, so the values are correct to about 16 significant figures. For every digit of a number such as 29!, use software with arbitrary-precision integers.
Where does the gamma function turn up outside pure mathematics?
Statistics uses it constantly: the gamma, chi-squared, Student's t and beta distributions all have Γ in their formulas. In geometry, the volume of a ball in d dimensions is π^(d/2) × r^d ÷ Γ(d/2 + 1), which is how the familiar 4/3 πr³ arises when d = 3.

How this page was produced

Published by
Quanta Calculator
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
Coming soon