n! = 1 × 2 × … × n, and 0! = 1 by definition (the empty product).
You can write it iteratively, with a running product in a loop, or recursively, as n! = n × (n−1)!. Recursion mirrors the math but uses stack space, while the loop uses O(1) memory.
Factorials explode: 20! is already about 2.4 × 10¹⁸. That's why later lessons compute combinatorics modulo a prime instead of computing exact values.