HomeCalculatorsMathNumber Theory & Discrete MathFactorial Calculator
Math calculator

Factorial Calculator

Calculate n! for integers 0 ≤ n ≤ 5000. Fast local exact integers with shareable, machine-readable results.

Instant result
Result

Enter values to calculate.

Inputs
Mode
Formula
Trust summary CVP VERIFIED · CVP protocol 1.0.0-proposed · Core assurance
Input interpretation
Enter values to calculate.
Result
Assurance
Core
Declared partition coverage
PASS · 2/2 declared partitions (factorial, invalid-domain) · Matrix
Numerical scope
Exact decimal-string identity vs Python math.factorial on the 23 published tabulated vectors (named 0,1,5,10,20,100,5000 plus 16 seeded n in 0–4999). 5000! is verified as the full 16,326-digit value and as SHA-256 of those ASCII digits. This is not a whole-domain proof beyond the published table.
Known limitations
  • 0 ≤ n ≤ 5000 ordinary factorial
  • Core CVP does not include live graph, viewport, or pointer interaction.
Model
n! for an integer n satisfying 0 ≤ n ≤ 5000, with optional product expansion, scientific notation for long integers, and digit count.
Scope
n is an integer satisfying 0 ≤ n ≤ 5000.
Verification
Engine tested · Source checked · v1.0.2 · CVP VERIFIED · CVP protocol 1.0.0-proposed · Core assurance· View Manifest · CVP overview · Specification
Versions
Calculation 1.0.2 · CVP protocol 1.0.0-proposed · Evidence 2026-09-08.exact-integer-profile
Verification revision
2026-09-08.exact-integer-profile · 19/19 property · digest b7065c58307c
Legacy regression
24/24 tests · Production surface contract 3/3
Reference
O1 model · O3 expected_values · O3 numerical_behavior · O2 expected_values · O2 numerical_behavior
Interfaces
PASS · UI (SSR) / REST / MCP — ui-ssr is query-result HTML, not a live browser session.
Supplemental domain review
Not performed
Named expert review
Not performed
CVP suite
6/6 golden · 7/7 CVP boundary · 6/6 invalid · 19/19 property · 5/5 metamorphic · 23/23 O3 · 1/1 cross-interface · 1/1 CVP contract · Manifest
Sources
Sources
Evidence
8 legacy golden · 7 legacy boundary · legacy regression suite · 6/6 oracle-backed golden · 6/6 invalid · Artifact integrity PASS
This calculator CURRENT · Public schema 1.0.2 matches · Semantic contract ✓ · Production attested · Public/cache ✓ · Origin ✓
Semantic contract
PASS
Full verification

Manifest identity, reference classes, interfaces, suite, and production records.

Formulas

Core equations used by this calculator.

Definitionn! = n × (n − 1) × (n − 2) × … × 1
Zero0! = 1
Recurrencen! = n × (n − 1)! (n ≥ 1)
PermutationsP(n,n) = n! (ordered arrangements of n distinct items)
iDefined only for non-negative integers in this tool. Results use exact integers via big-integer arithmetic. Values with more than 30 digits are shown in scientific notation together with the exact digit count.

How to use

1

Enter a non-negative integer n

Whole numbers only. The published domain is 0 ≤ n ≤ 5000. Fractions and negatives are not defined for ordinary factorial.

2

Calculate

Read n!, the product expansion when n is small, and — for results longer than 30 digits — scientific notation plus the exact digit count.

3

Use the count

For distinct items, n! is the number of different orderings (permutations).

Example calculations

Common configurations with formula and result.

ϟ

Five factorial

Classic homework check

5! = 5×4×3×2×1
120
ϟ

Ten factorial

Expansion to 3.6 million

10!
3,628,800
ϟ

Zero factorial

Empty product / one empty arrangement

0!
1
ϟ

One hundred factorial

Digit-count check at a large exact integer

100!
158 digits
ϟ

Word with unique letters

8 distinct letters → arrangements

8!
40,320
ϟ

Word with a repeated letter

7 letters, one letter twice

7! / 2!
2,520

Common factorial values

Common values at a glance.

nn!Expansion
01by definition
111
222 × 1
363 × 2 × 1
4244 × 3 × 2 × 1
51205 × 4 × 3 × 2 × 1
67206 × … × 1
75,0407 × … × 1
840,3208 × … × 1
9362,8809 × … × 1
103,628,80010 × … × 1
12479,001,60012 × … × 1
151,307,674,368,00015 × … × 1
202,432,902,008,176,640,00020 × … × 1
i n! grows extremely fast. This calculator returns an exact integer for every n in 0 ≤ n ≤ 5000. Values with more than 30 digits are summarized in scientific notation plus a digit count.

Factorial calculator specification

Version 1.0.2 · Engine tested

Calculation status

Review policy · Evidence

Definition
The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 through n. By definition 0! = 1. Factorials count ordered arrangements (permutations) of n distinct objects and appear in combinations, series, and probability.
What it calculates
n! for an integer n satisfying 0 ≤ n ≤ 5000, with optional product expansion, scientific notation for long integers, and digit count.
Inputs
  • Integer n with 0 ≤ n ≤ 5000
Outputs
  • Exact n! (grouped digits when ≤ 30 digits; scientific form when longer)
  • Product expansion for small n
  • Digit count of the exact integer
Formula
n! = n×(n−1)×…×1; 0! = 1
Assumptions
  • n is an integer satisfying 0 ≤ n ≤ 5000.
  • Ordinary (single) factorial only — not multifactorial and not the real Gamma function for non-integers.
Units
  • Dimensionless (counting / combinatorial)
Boundary conditions
  • Missing n → MISSING_REQUIRED_INPUT
  • Non-numeric n → INVALID_NUMBER
  • Non-integer n (for example 5.5) → INVALID_NUMBER
  • n < 0 → VALUE_MUST_BE_NON_NEGATIVE
  • n > 5000 → VALUE_ABOVE_MAX
Numerical precision
  • Interactive calculation uses exact BigInt locally: n! = 1×2×…×n, with 0! = 1 by definition.
  • Shareable URLs (?n=5 or ?nInput=5) are server-rendered with the same deterministic engine so crawlers and no-JS clients see the same result.
  • REST and SSR return { n, value, exact, digits, expansion, scientific, max_n }. value is a JSON number when it fits in IEEE-754 safe integers, otherwise the exact decimal string.
  • On-page display: exact grouped integer when digits ≤ 30; scientific notation plus digit count when digits > 30. Scientific notation is not shown for short values such as 5! = 120.
Example
5! = 120; 10! = 3,628,800; 100! has 158 digits; 5000! has 16,326 digits
Validation cases

12 published on this page · 24/24 tests · Production surface contract 3/3 · View evidence

  • n=0 → 1
  • n=1 → 1
  • n=5 → 120
  • n=10 → 3628800
  • n=20 → 2432902008176640000
  • n=100 → 158 digits
  • n=1000 → 2568 digits
  • n=5000 → 16326 digits
  • n=-1 → error VALUE_MUST_BE_NON_NEGATIVE
  • n=5.5 → error INVALID_NUMBER
  • n=5001 → error VALUE_ABOVE_MAX
  • empty n → error MISSING_REQUIRED_INPUT
Sources
  • NIST Digital Library of Mathematical Functions, Chapter 5 — Gamma Function
    Supports: Ordinary factorial of a nonnegative integer; n! = Γ(n+1)
  • NIST DLMF §5.4 — Special values and extrema
    Supports: n! = Γ(n+1), including 0! = 1. This calculator publishes ordinary factorial only; non-integer Gamma values are out of scope.
  • CalculatorX mathematical conventions — Domain 0 ≤ n ≤ 5000; exact BigInt n!
    Supports: Matches the on-page contract. Permutation count P(n,n)=n! is an interpretation, not a second engine.
Calculation version
1.0.2

Background

Interpretation and common distinctions.

What is a factorial?

For a non-negative integer n,

n! = n × (n−1) × (n−2) × ⋯ × 1

with the special case

0! = 1.

Equivalently, n! = n × (n−1)! for n ≥ 1.

Example:

10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800.

Related mathematics

The Gamma function extends factorial off the nonnegative integers via n! = Gamma(n+1) (NIST DLMF §5.4). This calculator publishes ordinary factorial only: integers satisfying 0 ≤ n ≤ 5000. Inputs such as 4.5! are out of scope.

Where factorials show up

  • Counting permutations and combinations
  • Probability and binomial coefficients binomnk = n! / (k!(n−k)!)
  • Taylor series and many algebra/discrete-math identities
  • Computer science (complexity of brute-force orderings)

Supported and not supported

Supported

  • Ordinary factorial n! for integers 0 ≤ n ≤ 5000
  • Exact BigInt integer, product expansion for small n, digit count, and scientific notation when digits > 30
  • Share URL, REST, and MCP via math.factorial

Not supported

  • Multifactorial (n!!, n!!!)
  • Gamma Gamma(n+1) for non-integers
  • n < 0 or n > 5000

Agent / API notes

Capability id: math.factorial · tool id: factorial · pin calculation_version: 1.0.2.

Stable error codes: MISSING_REQUIRED_INPUT, INVALID_NUMBER, VALUE_MUST_BE_NON_NEGATIVE, VALUE_ABOVE_MAX.

Aliases: n (canonical) and nInput (share URL / form id). Interactive calculation uses exact BigInt locally; shareable URLs are server-rendered with the same engine.

}

Frequently asked questions

Key distinctions behind the calculation.

What is a factorial?

n! multiplies n by every smaller positive integer down to 1. Example: 5! = 5×4×3×2×1 = 120.

Why is 0! equal to 1?

By definition the empty product is 1, and it keeps the recurrence n! = n×(n−1)! consistent at n = 1. There is also exactly one way to arrange an empty set.

What values of n are allowed?

Integers satisfying 0 ≤ n ≤ 5000. Negative factorials and non-integer gamma values are outside this calculator.

How many ways can n distinct objects be arranged?

There are n! permutations. For 4 distinct items, 4! = 24 orders.

What if some items are identical?

Divide by the factorial of each repeated count. For a 7-letter word with two identical letters: 7!/2!. Two different pairs of repeats: n!/(2!×2!).

Why does the answer switch to scientific notation?

Only when n! has more than 30 digits. Smaller values stay as the exact integer (with a digit count). The tool still knows the exact integer; large results show a compact ×10ⁿ form plus how many digits that integer has.

Is there a maximum n?

Yes. n must satisfy 0 ≤ n ≤ 5000 so the page stays responsive. 5000! is an exact integer with 16,326 digits.