Factorial Kalkulator
Gunakan Factorial Kalkulator ini untuk mendapatkan hasil yang cepat dan tepat.
Cara menggunakan kalkulator ini
- Masukkan n (integer ≥ 0)
- Klik butang Kira
- Baca keputusan yang dipaparkan di bawah kalkulator
Understanding Factorials
The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 to n. By definition: n! = n × (n-1) × (n-2) × ... × 2 × 1. Special case: 0! = 1 (this is defined, not a calculation, and is necessary for combinatorial formulas to work consistently).
Factorials grow explosively fast — faster than exponential functions. 10! = 3,628,800; 20! ≈ 2.43 × 10¹⁸; 100! ≈ 9.33 × 10¹⁵⁷. The number 170! is approximately 7.26 × 10³⁰⁶, which is the largest factorial representable as a 64-bit floating-point number. Our calculator uses BigInt arithmetic for exact integer results up to 170!.
The recursive definition of factorial is: n! = n × (n-1)! for n > 0, with 0! = 1 as the base case. This recursive structure makes factorial a classic introductory example in computer science for teaching recursion, dynamic programming, and memoization.
Factorials in Combinatorics and Probability
Factorials are essential in counting problems. The number of ways to arrange n distinct objects in a row is n! (called permutations). With 4 people in a line: 4! = 24 different arrangements. This applies to seating arrangements, scheduling, and any ordering problem.
Permutations: P(n,r) = n!/(n-r)! — the number of ways to choose r items from n in a specific order. Combinations: C(n,r) = n!/(r!(n-r)!) — the number of ways to choose r items from n regardless of order (binomial coefficient, written as nCr or ⁿCᵣ). These appear in the binomial theorem, Pascal's triangle, and probability calculations.
In probability, factorial underlies the Poisson distribution, binomial distribution, and multinomial distribution. Birthday problem: the probability that all 23 people have different birthdays = 365!/(365-23)! / 365²³ ≈ 49.3%, meaning there's a greater than 50% chance that at least two of 23 people share a birthday — a famous counterintuitive result.
Stirling's Approximation and Large Factorials
For large n, calculating exact factorials is impractical (100! has 158 digits). Stirling's approximation provides an excellent estimate: n! ≈ √(2πn) × (n/e)ⁿ. For n=10: Stirling gives ≈ 3,598,696 vs exact 3,628,800 — within 1%. The approximation improves as n grows.
The log-factorial ln(n!) = Σ ln(k) for k=1 to n is often more useful in computation than the factorial itself, because it avoids overflow. In machine learning, log probabilities are used instead of probabilities for numerical stability. The log-gamma function Γ(n+1) = n! for integers extends factorial to real and complex numbers.
Wilson's theorem connects factorials to primes: p is prime if and only if (p-1)! ≡ -1 (mod p). This provides a theoretical primality test, though it's computationally impractical for large numbers. The connection between factorials and prime numbers runs deep through number theory.
Frequently Asked Questions
Why is 0! = 1?
By convention and consistency: defining 0! = 1 makes combinatorial formulas work correctly. For example, C(n,0) = n!/(0!×n!) = 1, meaning there's exactly 1 way to choose 0 items from n (do nothing). Without this definition, many formulas would need special cases.
What is the factorial of a negative number?
Factorial is not defined for negative integers. The gamma function extends factorial to positive real numbers (and complex numbers), but negative integers remain undefined singularities.
How many zeros are at the end of 100!?
Count factors of 10 = 2×5. Since factors of 2 are more abundant than 5, count factors of 5 in 1-100: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24 trailing zeros.
Kemas kini terakhir: March 2026